From: trans Date: 2009-03-09T22:13:52+09:00 Subject: Re: Where's the best version of Hash#pass and Hash#block? On Mar 9, 8:23 am, Phlip wrote: > Matthias Reitinger wrote: > > Here's my shot at it: > > >   class Hash > >     def pass(*keys) > >       Hash[select {|k,v| keys.include? k}] > >     end > > >     def block(*keys) > >       reject {|k,v| keys.include? k} > >     end > >   end > > Dude that's so lean I'm tossing facets and going with it. Tx! #pass doesn't seem to work, at least not in 1.8. More importantly, Facets implementation is the way it is b/c it is fast. Code elegance is nice, but you won't be looking at the code when you are using it. user system total real except 0.150000 0.010000 0.160000 ( 0.155591) block 8.870000 0.020000 8.890000 ( 8.892466) T.