From: Jimmy Kofler Date: 2008-02-16T22:51:33+09:00 Subject: Re: recursive merge for hash > M.W. Mitchell wrote: > Thanks. But the only problem with that is, the overriding hash will > completely destroy *all* of the values in the original. So if I want > to just override one value, I get only one value. In this example, > "Sam" is lost: > > first = { > :data=>{ > :name=>{ > :first=>'Sam', > :middle=>'I', > :last=>'am' > } > } > } > > second={ > :data=>{ > :name=>{ > :middle=>'you', > :last=>'are' > } > } > } > all_new = first.merge(second) > > puts all_new.inspect How about Hash#deep_merge, http://snippets.dzone.com/posts/show/4706 ? Cheers, j.k. -- Posted via http://www.ruby-forum.com/.