End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
BasicObject#singleton_method_added
singleton_method_added(symbol)
object.c
View on GitHub ↗
#define rb_obj_singleton_method_added rb_obj_dummy1
Invoked as a callback whenever a singleton method is added to the receiver.
Example
module Chatty def Chatty.singleton_method_added(id) puts "Adding #{id.id2name}" end def self.one() end def two() end def Chatty.three() end end
produces:
Example
Adding singleton_method_added Adding one Adding three
See also
#__send__
#singleton_method_removed
#method_missing
#singleton_method_undefined
also in
4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.0