class Malevich::Hashie

Public Instance Methods

deep_merge(other_hash, &block) click to toggle source
# File lib/malevich/support/hash.rb, line 5
def deep_merge(other_hash, &block)
  dup.deep_merge!(other_hash, &block)
end
deep_merge!(other_hash, &block) click to toggle source
# File lib/malevich/support/hash.rb, line 9
def deep_merge!(other_hash, &block)
  other_hash.each_pair do |k,v|
    tv = self[k]
    if tv.is_a?(Hash) && v.is_a?(Hash)
      self[k] = tv.deep_merge(v, &block)
    else
      self[k] = block && tv ? block.call(k, tv, v) : v
    end
  end
  self
end
method_missing(method_name, *args, &blk) click to toggle source
# File lib/malevich/support/hash.rb, line 21
def method_missing(method_name, *args, &blk)
  self.[](method_name.to_sym, &blk)
end