Skip to content

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

instance method

Module#method_added

(::Symbol method_name) -> void
method_added(method_name)

Invoked as a callback whenever an instance method is added to the receiver.

Example
module Chatty
  def self.method_added(method_name)
    puts "Adding #{method_name.inspect}"
  end
  def self.some_class_method() end
  def some_instance_method() end
end

produces:

Example
Adding :some_instance_method