End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Class#inherited
inherited(subclass)
object.c
View on GitHub ↗
static VALUE
rb_obj_dummy1(VALUE _x, VALUE _y)
{
return rb_obj_dummy();
}
Callback invoked whenever a subclass of the current class is created.
Example:
Example
class Foo def self.inherited(subclass) puts "New subclass: #{subclass}" end end class Bar < Foo end class Baz < Bar end
produces:
Example
New subclass: Bar New subclass: Baz