mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Document order of execution const_added vs inherited
This commit is contained in:
parent
b47a04eb91
commit
08ce6268ee
Notes:
git
2025-04-10 08:33:53 +00:00
2 changed files with 44 additions and 0 deletions
24
object.c
24
object.c
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue