Issue #5360 has been updated by George Koehler.


I can get a Binding from a BasicObject like so:

 class Cow < BasicObject
   Moo = "Moooo!"
   def binding
     ::Kernel.binding
   end
 end
 
 b = Cow.new.binding
 p eval("Moo", b)        # => "Moooo!"
 p eval("String", b)     # raises NameError

This uses the syntax "::Kernel" to access a global constant.

----------------------------------------
Feature #5360: BasicObject#binding
http://redmine.ruby-lang.org/issues/5360

Author: Thomas Sawyer
Status: Feedback
Priority: Normal
Assignee: 
Category: core
Target version: 


For meta-programming purposes I think there needs to be a way to get a BasicObject's binding.



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