From: Gavin Kistner Date: 2006-10-26T04:31:31+09:00 Subject: Re: Pass block instead of here document? 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 class Foo def say_hi p "Hi!" end end tell Foo.new do say_hi end #=> "Hi!"