diff options
author | Jeremy Evans <code@jeremyevans.net> | 2021-10-26 10:35:21 -0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-26 12:35:21 -0700 |
commit | 717ab0bb2ee63dfe76076e0c9f91fbac3a0de4fd (patch) | |
tree | d2b531647657dd58e6ce6e64e3f6fa0adaa75f40 /include/ruby/internal/intern | |
parent | a4d5ee4f31bf3ff36c1a8c8fe3cda16aa1016b12 (diff) | |
download | ruby-717ab0bb2ee63dfe76076e0c9f91fbac3a0de4fd.tar.gz |
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>
Diffstat (limited to 'include/ruby/internal/intern')
-rw-r--r-- | include/ruby/internal/intern/class.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/ruby/internal/intern/class.h b/include/ruby/internal/intern/class.h index 60baf98472..835e85c26d 100644 --- a/include/ruby/internal/intern/class.h +++ b/include/ruby/internal/intern/class.h @@ -175,6 +175,19 @@ VALUE rb_mod_include_p(VALUE child, VALUE parent); VALUE rb_mod_ancestors(VALUE mod); /** + * Queries the class's descendants. This routine gathers classes that are + * subclasses of the given class (or subclasses of those subclasses, etc.), + * returning an array of classes that have the given class as an ancestor. + * The returned array does not include the given class or singleton classes. + * + * @param[in] klass A class. + * @return An array of classes where `klass` is an ancestor. + * + * @internal + */ +VALUE rb_class_descendants(VALUE klass); + +/** * Generates an array of symbols, which are the list of method names defined in * the passed class. * |