Paste: ruby procs+eval suckage example

Author: tizoc
Mode: ruby
Date: Wed, 8 Apr 2009 01:09:54
Plain Text |
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)

New Annotation

Summary:
Author:
Mode:
Body: