Skip to content

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)

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

  1. 3.2