Add Hash#deep_transform_values to extend/

This commit is contained in:
Douglas Eichelberger 2024-01-11 20:03:06 -08:00
parent 0cdd4eee3b
commit a87cdf0d21
5 changed files with 25 additions and 3 deletions

1
.gitignore vendored
View File

@ -63,7 +63,6 @@
!**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/
!**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/
!**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/*/
!**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/hash/deep_transform_values.rb
!**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/hash/keys.rb
!**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/object/deep_dup.rb
!**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/object/duplicable.rb

View File

@ -0,0 +1,22 @@
# typed: strict
class Hash
sig {
type_parameters(:out).params(
block: T.proc.params(o: Hash::V).returns(T.type_parameter(:out))
).returns(T::Hash[Hash::K, T.type_parameter(:out)])
}
def deep_transform_values(&block); end
sig {
type_parameters(:out).params(
block: T.proc.params(o: Hash::V).returns(T.type_parameter(:out))
).returns(T::Hash[Hash::K, T.type_parameter(:out)])
}
def deep_transform_values!(&block); end
sig { params(object: T.anything, block: T.untyped).returns(T.untyped) }
def _deep_transform_values_in_object(object, &block); end
sig { params(object: T.anything, block: T.untyped).returns(T.untyped) }
def _deep_transform_values_in_object!(object, &block); end
end

View File

@ -9,7 +9,7 @@ require "service"
require "utils/curl"
require "deprecate_disable"
require "active_support/core_ext/hash/deep_transform_values"
require "extend/hash/deep_transform_values"
# The {Formulary} is responsible for creating instances of {Formula}.
# It is not meant to be used directly from formulae.

View File

@ -92,7 +92,7 @@ class Tab
end
if attributes["source"]["spec"].nil?
version = PkgVersion.parse path.to_s.split("/")[-2]
version = PkgVersion.parse(File.basename(File.dirname(path)))
attributes["source"]["spec"] = if version.head?
"head"
else