Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
Class#inherited
inherited(subclass)
object.c
View on GitHub ↗
#define rb_obj_class_inherited rb_obj_dummy1
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