From: Tim Hunter Date: 2008-01-01T12:02:21+09:00 Subject: Re: how to store a block in a var? Giles Bowkett wrote: > Mil perdones, but my brain seems to have gone awol. I have multiple > places in a spec where I need to run the same block of code. I would > be much happier storing this block in a var as a Proc as opposed to > wrapping it up in a method. Is there a way I can do this? My spec > looks like this: > > do_stuff do > stuff > end > > where "stuff" is the part I want to wrap up into some tidy thing. I > tried it with lambda but my brain was too tired. > var = Proc.new { stuff } -- RMagick: http://rmagick.rubyforge.org/ RMagick 2: http://rmagick.rubyforge.org/rmagick2.html