From: Joel VanderWerf Date: 2002-12-23T08:58:49+09:00 Subject: Re: Hash#update Gavin Sinclair wrote: > I think > > hash1 | hash2 > > would be good. It tends to communicate nondestructiveness. That's especially good if you're using hashes as "characteristic functions" of sets, in which case this '|' is union: class Hash def |(h) dup.update(h) end end elves = {'Legolas' => true, 'Galadriel' => true} reindeer = {'Dasher' => true, 'Dancer' => true, 'Prancer' => true, 'Vixen' => true, 'Donner' => true, 'Comet' => true, 'Cupid' => true, 'Blitzen' => true, 'Rudolph' => true, 'Olive' => true} p (elves | reindeer)['Comet'] # ==> true p (elves['Comet'] | reindeer['Comet']) # ==> true Eagerly eyeing the ruby-shaped package under tree, Joel