class BasicObject
def === (cmp)
def === (cmp) true end
def inherited(sub)
and M.method_added for any module M included in Object or a submodule
Ideally, we'd do this by trapping Object.method_added
We'll do this whenever a class is derived from BasicObject
either directly or through an included module.
Let's try to keep things clean, in case methods have been added to Object
def inherited(sub) BasicObject.class_eval do (instance_methods - KEEP).each do |method| if Object.method_defined?(method) && instance_method(method).owner == Object.instance_method(method).owner undef_method method end end end end