class MyClass def test(somearg) @value = somearg + 7 lambda {|num| num * num} end end o = MyClass.new f = o.test(10) eval("p @value", f) eval("p somearg", f)
Done