From: Daniel Berger Date: 2008-04-13T15:14:46+09:00 Subject: Re: Hash#slice On Apr 12, 3:00 pm, ara howard wrote: > is this consistent with other peoples stdlib hacks? > > class Hash > def slice *keys, &block > if block > each do |key, val| > boolean = block.call(key, val) > keys << key if boolean > end > end > hash = self > keys.inject({}){|returned, key| returned.update key => hash[key]} > end > end http://raa.ruby-lang.org/project/hashslice/ Regards, Dan