From: Gennady Bystritsky Date: 2006-10-03T04:15:59+09:00 Subject: Re: instance_eva()l-ing a proc with parameters Logan Capaldo wrote: > On Tue, Oct 03, 2006 at 01:35:48AM +0900, Gennady Bystritsky wrote: >> Dear friends, >> >> I need to evaluate a proc within an instance context and would like >> to pass it a parameter. The only straight forward way I found is to >> use instance_eval(), however it does not allow to pass parameters to >> a proc, only the instance itself is passed as a single parameter: > Google for instance_exec, there are various and sundry > implementations, including one built into rails. > > http://eigenclass.org/hiki.rb?instance_exec has various > implementations and their respective strengths and weaknesses. Or you > can > just use ruby > 1.9 where it's part of the core. Thanks a lot, Logan. That's exactly what I need and what I have missed completely here on the list when the discussion first came up. It looks like I am better off sticking to my define_method() custom solution for now, as instance_exec() uses the same approach anyway. Thanks again, Gennady.