Florian Weber wrote: >Hi! > >Is there a way to remove a class for good from the ObjectSpace? I >would like to redefine a class entirely without any 'leftovers' of the >previous definition. > >Thanks! > >Ciao! >Florian > > > Might be a tad bit too tricky, AFAIK, classes are more or less global constants and reference roots. Hack up something to undef all the methods that aren't inherited from the class and the singleton class? E. g.: Foo.class_eval { public_instance_methods(false).each { | method_name | eval "undef #{method_name}" } } Similar for its singleton class. At least that's as good a way as I can think of, if you mean to redefine the class anyway. Whether the parse trees for the undeffed methods are deallocated too, I'll leave to the savvier hackers to answer. David Vallner