Trans
3/9/2009 1:14:00 PM
On Mar 9, 8:23=A0am, Phlip <phlip2...@gmail.com> wrote:
> Matthias Reitinger wrote:
> > Here's my shot at it:
>
> > =A0 class Hash
> > =A0 =A0 def pass(*keys)
> > =A0 =A0 =A0 Hash[select {|k,v| keys.include? k}]
> > =A0 =A0 end
>
> > =A0 =A0 def block(*keys)
> > =A0 =A0 =A0 reject {|k,v| keys.include? k}
> > =A0 =A0 end
> > =A0 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.