From: Joel VanderWerf Date: 2004-04-24T14:28:45+09:00 Subject: Re: pushing hash nobu.nokada@softhome.net wrote: > $ irb --prompt xmp ^^^^^^^^^^^^ That's a great feature. It would be nice if the output began with a comment char '#' so that you could paste into irb (or a source file) and run. > class Hash > alias << :update > end > ==>nil > table = Hash.new {{}} > ==>{} > table["foo"] <<= {"x"=>1} > ==>{"x"=>1} > table > ==>{"foo"=>{"x"=>1}} > table["bar"] Did you mean something like this? table["bar"] << {"y"=>2} > ==>{} > table > ==>{"foo"=>{"x"=>1}} > > Since <<= is assignment "foo" is added, but "bar" is not.