Sha256: a4077d6a864eb9e377b306c97b14fdd9195249a1acd9cc1b92ae6c049725215b
Contents?: true
Size: 843 Bytes
Versions: 2
Compression:
Stored size: 843 Bytes
Contents
class Hash # Same as Hash#merge but recursively merges sub-hashes. # # DEPRECATE: This method will be deprecated in favor of # <code>recursive.merge</code>. def recursive_merge(other) hash = self.dup other.each do |key, value| myval = self[key] if value.is_a?(Hash) && myval.is_a?(Hash) hash[key] = myval.recursive_merge(value) else hash[key] = value end end hash end # Same as Hash#merge! but recursively merges sub-hashes. # # DEPRECATE: This method will be deprecated in favor of # <code>recursive.merge!</code>. def recursive_merge!(other) other.each do |key, value| myval = self[key] if value.is_a?(Hash) && myval.is_a?(Hash) myval.recursive_merge!(value) else self[key] = value end end self end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
facets-2.8.4 | lib/core/facets/hash/recursive_merge.rb |
facets-2.8.3 | lib/core/facets/hash/recursive_merge.rb |