From: "beanstalksurf (Jacob Burkhart)" Date: 2013-05-31T10:40:58+09:00 Subject: [ruby-core:55211] [ruby-trunk - Feature #8465] Proc set_binding Issue #8465 has been updated by beanstalksurf (Jacob Burkhart). Oops, I meant that last line to say: #I expect... foo_putter.set_binding(FooFoo.new.foo_foo_proc.binding) foo_putter.call("blah") #to output: # foo blah ---------------------------------------- Feature #8465: Proc set_binding https://bugs.ruby-lang.org/issues/8465#change-39571 Author: beanstalksurf (Jacob Burkhart) Status: Open Priority: Normal Assignee: Category: Target version: instance_eval is a solution to evaluate a proc in the binding of another object but it is not a solution for a Proc that takes arguments I propose that in order to suppor this use-case we need <#Proc>.set_binding Example: class BarFoo def foo(arg) "bar #{arg}" end def puts_a_foo Proc.new do |arg| puts self.foo(arg) end end end class FooFoo def foo(arg) "foo #{arg}" end def foo_foo_proc Proc.new{} end end foo_putter = BarFoo.new.puts_a_foo foo_putter.call("blah") # bar blah FooFoo.new.instance_eval(&foo_putter) #foo # foo_putter.binding.eval("puts self.foo('blah')") # bar blah FooFoo.new.foo_foo_proc.binding.eval("puts self.foo('blah')") # foo blah #I expect... foo_putter.set_binding(FooFoo.new.foo_foo_proc.binding) foo_putter.call("blah") #to output: # foo foo -- http://bugs.ruby-lang.org/