Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/platformos_check/ext/hash.rb
Instance Method Summary collapse
Instance Method Details
#deep_merge(other_hash) ⇒ Object
16 17 18 |
# File 'lib/platformos_check/ext/hash.rb', line 16 def deep_merge(other_hash, &) dup.deep_merge!(other_hash, &) end |
#deep_merge!(other_hash, &block) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/platformos_check/ext/hash.rb', line 4 def deep_merge!(other_hash, &block) merge!(other_hash) do |key, this_val, other_val| if this_val.is_a?(Hash) && other_val.is_a?(Hash) this_val.deep_merge(other_val, &block) elsif block yield(key, this_val, other_val) else other_val end end end |