From: Tim Pease Date: 2006-10-26T04:39:30+09:00 Subject: Re: Pass block instead of here document? On 10/25/06, Morton Goldberg wrote: > I have a situation where I want to send many messages, one after the > other, to single object. Instead of writing, say, > > > Foo.new.perform { report; eat 'burger', 'fries'; drink 'beer'; > be_merry } > > class Foo def initialize( &block ) return unless block_given? self.instance_eval &block end def eat( *args ) puts args.inspect end def drink( *args ) puts args.inspect end end Foo.new do eat 'burger', 'fries' drink 'beer' end Is that what you are looking for? You can just as easily create a process method (instead of using the initialize method) to do something like this ... f = Foo.new f.process do eat 'burger', 'fries' drink 'beer' end Blessings, TwP