Pit Capitain
8/22/2007 7:59:00 PM
2007/8/22, Emmanuel Oga <oga_emmanuel_oga@yahoo.com.ar>:
> Hello, basically i want to change the self object inside a proc so i can
> do a thing like this:
>
> the_proc= lambda { @variable }
>
> class Test1
> def initialize proc
> @variable= 1
> # Here i need to bind somehow the proc to the instance of Test1
> puts proc.call # should emit 1 from @variable
> end
> end
>
> (...)
Emmanuel, just change
proc.call
to
instance_eval(&proc)
Regards,
Pit