From: Ken Bloom Date: 2006-10-26T09:45:13+09:00 Subject: Re: Pass block instead of here document? On Thu, 26 Oct 2006 04:31:31 +0900, Gavin Kistner wrote: > From: Morton Goldberg [mailto:m_goldberg@ameritech.net] >> I'd rather pass in a block. Is there a way to do that? Something like: >> >> >> module Kernel >> def tell(obj, &to_do) >> # what goes here? >> end >> end >> >> tell Foo.new do >> report >> eat 'burger', 'fries' >> drink 'beer' >> be_merry >> end >> > > def tell( obj, &to_do ) > obj.instance_eval( &to_do ) > end Heck. Why bother with tell in the first place? Why not call instance_eval directly? --Ken -- Ken Bloom. PhD candidate. Linguistic Cognition Laboratory. Department of Computer Science. Illinois Institute of Technology. http://www.iit.edu/~kbloom1/ I've added a signing subkey to my GPG key. Please update your keyring.