Bug #2161: Kernel.eval ignores binding in 1.9
http://redmine.ruby-lang.org/issues/show/2161

Author: Aaron Wieland
Status: Open, Priority: Normal
ruby -v: 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin9.8.0]

Kernel.eval no longer evaluates its string in the context of the binding passed to it.

In an irb session in 1.8.6:

  irb(main):001:0> eval 'self'
  => main
  irb(main):002:0> obj = Object.new
  => #<Object:0x12aaf20>
  irb(main):003:0> eval 'self', obj.send(:binding)
  => #<Object:0x12aaf20>

In 1.9.1 (also tested in the latest nightly build for 1.9.2):

  irb(main):001:0> obj = Object.new
  => #<Object:0x5210f8>
  irb(main):002:0> eval 'self', obj.send(:binding)
  => main

I can't help but feel I'm missing something, because a bug of this magnitude should have been identified and fixed by now (it breaks a lot of code that uses ERb).


----------------------------------------
http://redmine.ruby-lang.org