diff options
author | Xavier Noria <fxn@hashref.com> | 2025-02-16 20:30:40 +0100 |
---|---|---|
committer | Jean Boussier <jean.boussier@gmail.com> | 2025-04-10 10:33:36 +0200 |
commit | 08ce6268ee1690f003af40b9357272d43e990d75 (patch) | |
tree | 0d04ac6c12879fa0d80e4a387561f1bd51541a1d /object.c | |
parent | b47a04eb9151a9fa59979fbaf20deeb404822959 (diff) |
Document order of execution const_added vs inherited
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/12759
Diffstat (limited to 'object.c')
-rw-r--r-- | object.c | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -1193,6 +1193,30 @@ rb_class_search_ancestor(VALUE cl, VALUE c) * * Added :FOO * + * If we define a class using the <tt>class</tt> keyword, <tt>const_added</tt> + * runs before <tt>inherited</tt>: + * + * module M + * def self.const_added(const_name) + * super + * p :const_added + * end + * + * parent = Class.new do + * def self.inherited(subclass) + * super + * p :inherited + * end + * end + * + * class Child < parent + * end + * end + * + * <em>produces:</em> + * + * :const_added + * :inherited */ #define rb_obj_mod_const_added rb_obj_dummy1 |