brew vendor-gems: commit updates.

This commit is contained in:
Douglas Eichelberger 2024-01-11 20:04:14 -08:00
parent a87cdf0d21
commit 14f8a086d8
2 changed files with 24 additions and 29 deletions

View File

@ -16,9 +16,7 @@ class Hash
# h2 = { b: 250, c: { c1: 200 } }
# h1.deep_merge(h2) { |key, this_val, other_val| this_val + other_val }
# # => { a: 100, b: 450, c: { c1: 300 } }
def deep_merge(other_hash, &block)
dup.deep_merge!(other_hash, &block)
end
def deep_merge(other_hash, &block) = dup.deep_merge!(other_hash, &block)
# Same as +deep_merge+, but modifies +self+.
def deep_merge!(other_hash, &block)

View File

@ -10,18 +10,15 @@ class Hash
#
# hash.deep_transform_values{ |value| value.to_s.upcase }
# # => {person: {name: "ROB", age: "28"}}
def deep_transform_values(&block)
_deep_transform_values_in_object(self, &block)
end
def deep_transform_values(&block) = _deep_transform_values_in_object(self, &block)
# Destructively converts all values by using the block operation.
# This includes the values from the root hash and from all
# nested hashes and arrays.
def deep_transform_values!(&block)
_deep_transform_values_in_object!(self, &block)
end
def deep_transform_values!(&block) = _deep_transform_values_in_object!(self, &block)
private
# Support methods for deep transforming nested hashes and arrays.
def _deep_transform_values_in_object(object, &block)
case object