Module: Lev::Utilities

Defined in:
lib/lev/utilities.rb

Class Method Summary collapse

Class Method Details

.deep_merge(hash, override_hash) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/lev/utilities.rb', line 4

def self.deep_merge(hash, override_hash)
  result = hash.dup
  override_hash.each_pair do |k,v|
    tv = result[k]
    result[k] = tv.is_a?(Hash) && v.is_a?(Hash) ? deep_merge(tv, v) : v
  end
  result
end