methods/undef_inherited_core_methods.rb
tests/_examples/methods/undef_inherited_core_methods.rb in the metorex repository.
class BlankSlate
kept = [:__id__, :__send__, :object_id, :class, :respond_to?]
instance_methods.each do |name|
undef_method(name) unless kept.include?(name)
end
end
p BlankSlate.instance_methods.sort
Output:
[:__id__, :__send__, :class, :object_id, :respond_to?]