Add Class#descendants

Doesn't include receiver or singleton classes.

Implements [Feature #14394]

Co-authored-by: fatkodima <fatkodima123@gmail.com>
Co-authored-by: Benoit Daloze <eregontp@gmail.com>
This commit is contained in:
Jeremy Evans 2021-10-26 10:35:21 -09:00 committed by GitHub
parent a4d5ee4f31
commit 717ab0bb2e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
Notes: git 2021-10-27 04:35:44 +09:00
Merged: https://github.com/ruby/ruby/pull/4974

Merged-By: jeremyevans <code@jeremyevans.net>
6 changed files with 122 additions and 0 deletions

View file

@ -4653,6 +4653,7 @@ InitVM_Object(void)
rb_define_method(rb_cClass, "new", rb_class_new_instance_pass_kw, -1);
rb_define_method(rb_cClass, "initialize", rb_class_initialize, -1);
rb_define_method(rb_cClass, "superclass", rb_class_superclass, 0);
rb_define_method(rb_cClass, "descendants", rb_class_descendants, 0); /* in class.c */
rb_define_alloc_func(rb_cClass, rb_class_s_alloc);
rb_undef_method(rb_cClass, "extend_object");
rb_undef_method(rb_cClass, "append_features");