module Nuggets::Hash::DeepMergeMixin

Public Instance Methods

deep_merge(other_hash) → aHash click to toggle source

Merges nested hashes recursively (see Hash#merge).

# File lib/nuggets/hash/deep_merge_mixin.rb, line 35
def deep_merge(other)
  merge(other) { |key, old, new|
    old.respond_to?(:deep_merge) ? old.deep_merge(new) : new
  }
end
deep_merge!(other_hash) → hash click to toggle source

Destructive version of deep_merge.

# File lib/nuggets/hash/deep_merge_mixin.rb, line 45
def deep_merge!(other)
  replace(deep_merge(other))
end
Also aliased as: deep_update
deep_update(other)
Alias for: deep_merge!