From: "David A. Black" Date: 2009-07-05T21:33:26+09:00 Subject: Re: to_proc and Proc/block conversion with & Hi -- On Sun, 5 Jul 2009, Robert Dober wrote: > On 7/5/09, David A. Black wrote: >> Yes; the & means: take what's to the right of it (which can be any >> expression), evaluate it, call to_proc on the resulting object, and >> use the return value of to_proc to play the code block role. >> >> In the case of a lambda, to_proc just returns the receiver. So you can >> do: >> >> array.map &lambda {|x| x * 10 } > It might be interesting to note that in Ruby1.9 the to_proc is not > called on Proc objects, I wonder what happened in 1.8 I guess it's an optimization. So take my explanation as behavioral rather than implementation-faithful. David -- David A. Black / Ruby Power and Light, LLC Ruby/Rails consulting & training: http://www.rubypal.com Now available: The Well-Grounded Rubyist (http://manning.com/black2) Training! Intro to Ruby, with Black & Kastner, September 14-17 (More info: http://rubyurl.com/vmzN)