From: Bertram Scharpf Date: 2009-07-05T23:52:17+09:00 Subject: Re: to_proc and Proc/block conversion with & Hi, Am Sonntag, 05. Jul 2009, 19:51:28 +0900 schrieb David A. Black: > On Sun, 5 Jul 2009, Joel VanderWerf wrote: >> Russ McBride wrote: >> >> constructing a Proc using &: >> >> def map(&b) >> b.call ... >> end >> >> or equivalently with Proc.new: >> >> def map >> b = Proc.new >> b.call >> end > > That's not going to access the caller's code, though, since you're > creating a totally new Proc. Sorry, but these are not the same: Proc.new Proc.new { } Try this: def f ; Proc.new ; end p = f { "hello" } p.call #=> "hello" Bertram -- Bertram Scharpf Stuttgart, Deutschland/Germany http://www.bertram-scharpf.de