Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/startupstats/core_ext/hash.rb
Instance Method Summary collapse
-
#deep_merge(hash) ⇒ Hash
Merges self with another hash, recursively.
Instance Method Details
#deep_merge(hash) ⇒ Hash
Merges self with another hash, recursively
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/startupstats/core_ext/hash.rb', line 7 def deep_merge(hash) target = self.dup hash.keys.each do |key| if hash[key].is_a?(Hash) && self[key].is_a?(Hash) target[key] = target[key].deep_merge(hash[key]) next end target[key] = hash[key] end target end |