Trans schrieb:
> I imagine ObjectSpace._id2ref and parsing inspect would work.

Too easy, Tom, much too easy :-) Yes, this should work, too, of course. 
The only gotchas are that you should make sure that the original #to_s 
method is used, and you'd have to add a special case for singleton 
classes of modules:

   p class << Module; self; end  # => #<Class:Module>

Regards,
Pit