From: Chris Pine Date: 2002-12-12T03:20:01+09:00 Subject: deleting a class Hello, I'm try to find a way to completely delete a class. (What I would eventually like is a way to load an entire GUI by default, but if the user requests a new one, I'd like to unload the old one and load up the new one.) So, in this code I create class Foo, but I can't figure out how to delete it. Am I doing the GC wrong, or is there some reference to Foo I haven't yet deleted? Or both? def getAllClasses classes = [] ObjectSpace.each_object (Class) do |klass| classes << klass.to_s end classes end def getAllConstants Module.constants end originalClasses = getAllClasses originalConstants = getAllConstants class Foo end Object.module_eval { remove_const 'Foo' } GC.start puts 'New classes: '+(getAllClasses - originalClasses ).join(', ') puts 'New constants: '+(getAllConstants - originalConstants).join(', ') Thanks for any help you can offer, Chris