Call remove_const to remove a class definition : remove_const « Reflection « Ruby





Call remove_const to remove a class definition


class MyClass
end

myInstance = MyClass.new

class Object
  remove_const :MyClass
end

# Can't instantiate MyClass again! (Though myInstance still exists...)

 










Related examples in the same category