End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method · added in Ruby 3.2
Module#const_added
const_added(const_name)
object.c
View on GitHub ↗
#define rb_obj_mod_const_added rb_obj_dummy1
Invoked as a callback whenever a constant is assigned on the receiver
Example
module Chatty def self.const_added(const_name) super puts "Added #{const_name.inspect}" end FOO = 1 end
produces:
Example
Added :FOO
Ruby version changes
-
3.2
-
Module#const_addedhas been added. [Feature #17881]
-
See also
#class_variable_set
#constants
#class_variables
#const_defined?
also in
4.1 · 4.0 · 3.4 · 3.3