Joel VanderWerf <vjoel / PATH.Berkeley.EDU> writes: > [ ... ] > > The output says XYZ is toplevel. The constant is added in the top level > scope because that is the scope of the block in which the constant > assignment happens. Here's another example: > > module Foo; end > > module Bar > $block = proc { XYZ = 1 } > end > > Foo.module_eval(&$block) > > p Bar::XYZ # ==> 1 > p Foo::XYZ # ==> uninitialized constant > > Looks weird at first, but it's because constants are statically > (lexically) scoped. XYZ occurs in a block whose scope is Bar, so that's > where the constant is defined when the block is called. Thanks. I get it. It indeed seems counter-intuitive, but if that's the way that constants are scoped in ruby, then so be it. > [ ... ] > > So just use #read instead of #load, and pass that string to module_eval. Yep. That works fine. Thanks. -- Lloyd Zusman ljz / asfast.com God bless you.