From: Jason Roelofs Date: 2007-01-01T06:01:34+09:00 Subject: Re: passing a block around... ------=_Part_156442_29631561.1167598891721 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Well, while I don't quite understand everything you've said here, the mechanism for passing blocks around is simple: def foo(&block) baz block end def baz(&block) block.call(params) end Hope that helps. Jason On 12/31/06, J2M wrote: > > I want to pass a block to method foo then call method bar from foo and > have bar yield to the block, I also want to be able to call bar > directly with a block, how to do this neatly. > > e.g. I want to be able to do > > foo { |baz| do stuff with baz } > bar { |baz| do other stuff with baz } > > but when foo gets a block it passes it to bar in the background. > > Thanks, > James > > > ------=_Part_156442_29631561.1167598891721--