From: Eugene Ventimiglia Date: 2001-03-01T02:52:23+09:00 Subject: [ruby-talk:11793] Re: How do I reach members from a Proc? > > One more thing: > > How do I pass parameters to @action? Code's modified below > > Currently you can't (although that was an extension that was briefly > discussed. Matz?) > > If you need to do that, I'd sugges taking Matz's approach. #Here's the same using Matz's approach: class Hello def install(&p) @action=p end def do(thing) @action.call(self,thing) # instance_eval(&@action(thing)) #??? end def help(frotz) puts "in help: " + frotz.to_s end end h=Hello.new h.install {|h,frump| puts "in proc: " + frump.to_s h.help frump } h.do("fish") #### It works, but it's a shame to have to pass the instance all the way in...