On Feb 11, 2007, at 7:41 PM, Victor Zverok Shepelev wrote:
> Just due to this ugliness, and, additionally, I can't (or don't  
> want) modify
> entire "A" class. More specifically, I have something like "scripts" -
> files, which are loaded and evaluated inside some objects. For  
> example (it's
> about new GUI library, BTW):

This uses eval on a string, which can be dangerous, but if you are  
already
reading script files and executing them....

module X
   TEST = 5
end

class A; end
a = A.new

class <<a
   def instance_binding
     binding
   end
end

script = "extend X; p TEST"  # could read this from a file

eval script, a.instance_binding   # XXX dangerous