# File 'lib/hash.rb', line 2defdeep_merge(hash)target=duphash.keys.eachdo|key|ifhash[key].is_a?Hashandself[key].is_a?Hashtarget[key]=target[key].deep_merge(hash[key])nextendtarget[key]=hash[key]endtargetend
#deep_merge!(second) ⇒ Object
14
15
16
17
18
19
20
21
22
# File 'lib/hash.rb', line 14defdeep_merge!(second)second.each_pairdo|k,v|ifself[k].is_a?(Hash)andsecond[k].is_a?(Hash)self[k].deep_merge!(second[k])elseself[k]=second[k]endendend