------art_47556_18829654.1216285635206
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

2008/7/17 Martin Boese <boesemar / gmx.de>:

> In a program I module_eval class definitions into a dynamically created
> namespace. To run support code later on I need to know the module it was
> defined in from an instance of the class.



Would Module.nesting work for you?

irb(main):001:0> module X
irb(main):002:1>   class A
irb(main):003:2>     def nesting
irb(main):004:3>       Module.nesting
irb(main):005:3>     end
irb(main):006:2>   end
irb(main):007:1> end
nil
irb(main):008:0> X::A.new.nesting
[X::A, X]

------art_47556_18829654.1216285635206--