summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2021-10-26 10:35:21 -0900
committerGitHub <noreply@github.com>2021-10-26 12:35:21 -0700
commit717ab0bb2ee63dfe76076e0c9f91fbac3a0de4fd (patch)
treed2b531647657dd58e6ce6e64e3f6fa0adaa75f40 /include
parenta4d5ee4f31bf3ff36c1a8c8fe3cda16aa1016b12 (diff)
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>
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4974 Merged-By: jeremyevans <code@jeremyevans.net>
Diffstat (limited to 'include')
-rw-r--r--include/ruby/internal/intern/class.h13
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.
*