March 19th, 2007
>> def foo; puts "bar"; end
=> nil
>> p = :foo.to_proc
=> #<Proc:0xb7bbad20@/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/core_ext/symbol.rb:10>
>> p = :foo.to_proc
=> #<Proc:0xb7bbad20@/usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/core_ext/symbol.rb:10>
>> eval(p.to_ruby).call
NameError: undefined local variable or method `obj' for #<Object:0xb7d359fc>
from (eval):2
from (irb):28:in `call'
from (irb):28
from :0
>> p.to_ruby
=> "proc { |*args|\n obj.send(self, *args)\n}"
Sorry, comments are closed for this article.