Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

instance method

BasicObject#singleton_method_undefined

(::Symbol name) -> nil
singleton_method_undefined(symbol)

Invoked as a callback whenever a singleton method is undefined in the receiver.

Example
module Chatty
  def Chatty.singleton_method_undefined(id)
    puts "Undefining #{id.id2name}"
  end
  def Chatty.one()   end
  class << self
     undef_method(:one)
  end
end

produces:

Example
Undefining one