Enable the "finalize" method for the given class. Normally, when a finalizer is called, the object has already been garbage collected. This will create a proxy object that keeps the object around so that the object's "finalize" method can be called; the object is then garbage collected.
The resulting proxy class will be frozen, since adding new methods to the proxy class would probably not have the desired effect. The original class will have the name Class_Finalize_Wrapped, where Class is that name of the original class.
TODO: Because this class uses method_missing_delegate, constants may not be properly delegated.
class Foo def initialize puts "initialize" end
def finalize puts "finalize" end end enable_finalize(:Foo)
def foo f = Foo.new end
foo #=> initialize GC.start #=> finalize