From: Adam Shelly Date: 2008-05-14T01:51:48+09:00 Subject: Re: hash merge On 5/13/08, Robert Klemme wrote: > On 13.05.2008 17:14, Yossef Mendelssohn wrote: > > Thanks for teaching me about Hash#merge with a block, by the way. > > > > Not really: > > irb(main):009:0> h = {1=>2} > => {1=>2} > irb(main):010:0> h.merge(10=>20) {|*a| p a} > => {1=>2, 10=>20} > irb(main):011:0> > > The block is simply ignored. > Not really: irb(main):010:0> h={1,2} => {1=>2} irb(main):011:0> h.merge(10=>20){|*a| p a} => {1=>2, 10=>20} irb(main):012:0> h.merge(1=>20){|*a| p a} [1, 2, 20] => {1=>nil} irb(main):013:0> The block is only called for matching keys. -Adam