Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/co2.rb
Instance Method Summary collapse
Instance Method Details
#deep_merge(hash) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/co2.rb', line 21 def deep_merge(hash) target = dup hash.keys.each do |key| if hash[key].is_a? Hash and self[key].is_a? Hash target[key] = target[key].deep_merge(hash[key]) next end target[key] = hash[key] end target end |