From: Morton Goldberg Date: 2006-10-26T14:29:03+09:00 Subject: Re: Pass block instead of here document? On Oct 25, 2006, at 8:45 PM, Ken Bloom wrote: > 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? Syntactic sugar. I guess I have a sweet tooth. Regards, Morton