From: Kent Dahl Date: 2003-06-24T18:25:24+09:00 Subject: Re: Accessing Objects from Anonymous Namespace lunfis@gmx.de wrote: > Is there any way to access objects (eg. constants) from within a 'module' > that was loaded with wrap=true, like > > foo.rb: > X = 1 > > baz.rb: > load('foo.rb',true) > > puts X AFAIK, only through nefarious programming: def collect_modules mods = [] ObjectSpace.each_object(Module){|m| mods << m } mods end before = collect_modules load('foo.rb',true) after = collect_modules m = (after - before)[0] puts m::X Very thread unsafe btw. There probably exists some neat hooks, but I can't find any right now. -- (\[ Kent Dahl ]/)_ _~_ _____[ http://www.pvv.org/~kentda/ ]_____/~ ))\_student_/(( \__d L b__/ (pre-) Master of Science in Technology ) ( \__\_�|�_/__/ ) _)Industrial economics and technological management( \____/_�_\____/ (____engineering.discipline_=_Computer::Technology___)