From: "Marcel Molina Jr." Date: 2006-03-21T04:52:10+09:00 Subject: Re: passing block to another function On Tue, Mar 21, 2006 at 04:48:50AM +0900, Shea Martin wrote: > I have a function: > > def worker( &p_block ) > .... > p_block.call( my_data ) > .... > end > > I have a wrapper function, that I would like to use to call 'worker'. > But I would like the caller of 'wrapper' to be able to specify the block > 'wrapper' will use. i.e., > > def wrapper( &p_block ) > .... > worker{ p_block } > end > > I suspect that this is possible, but I can't seem to nail the syntax. def worker(&block) block.call(data) end def wrapper(&block) worker(&block) end marcel -- Marcel Molina Jr.