class Hash
Public Instance Methods
deep_merge(other_hash, &block)
click to toggle source
# File lib/nifty_settings/settings.rb, line 158 def deep_merge(other_hash, &block) self.dup.tap do |this_hash| other_hash.each_pair do |k, v| tv = this_hash[k] this_hash[k] = case when tv.is_a?(Hash) && v.is_a?(Hash) tv.deep_merge(v, &block) when block_given? && tv block.call(k, tv, v) else v end end end end