Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/dry-stack/stack.rb
Instance Method Summary collapse
Instance Method Details
#deep_merge!(second) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/dry-stack/stack.rb', line 21 def deep_merge!(second) merger = proc { |_, v1, v2| if Hash === v1 && Hash === v2 v1.merge!(v2, &merger) else if Array === v1 && Array === v2 v1 | v2 else [:undefined, nil, :nil].include?(v2) ? v1 : v2 end end } merge!(second.to_h, &merger) end |