Gary Wright
1/8/2008 4:35:00 AM
On Jan 7, 2008, at 11:06 PM, L A wrote:
> Hello all,
>
> Is there a way to turn a Proc into a block for the purposes of
> methods that yield to blocks? It's not a necessity as I can always
> wrap the Proc in a block, I'm just curious.
Just prefix the object you want to be passed as a block with '&' in
the argument list.
p = proc { |x| x > 10 }
[1,5,10,20, 30].select &p
Gary Wright