diff options
author | Jean Boussier <jean.boussier@gmail.com> | 2021-10-28 14:07:11 +0200 |
---|---|---|
committer | Jean Boussier <jean.boussier@gmail.com> | 2021-11-23 10:50:44 +0100 |
commit | c0c2b31a35e19a47b499b57807bc0a0f9325f6d3 (patch) | |
tree | ab7ee0710597903b43a8d086a3805059693de928 /NEWS.md | |
parent | a88b19d3d08447eeb7045621f02a844173d64203 (diff) | |
download | ruby-c0c2b31a35e19a47b499b57807bc0a0f9325f6d3.tar.gz |
Add Class#subclasses
Implements [Feature #18273]
Returns an array containing the receiver's direct subclasses without
singleton classes.
Diffstat (limited to 'NEWS.md')
-rw-r--r-- | NEWS.md | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -121,6 +121,21 @@ Outstanding ones only. C.descendants #=> [] ``` + * Class#subclasses, which returns an array of classes + directly inheriting from the receiver, not + including singleton classes. + [[Feature #18273]] + + ```ruby + class A; end + class B < A; end + class C < B; end + class D < A; end + A.subclasses #=> [D, B] + B.subclasses #=> [C] + C.subclasses #=> [] + ``` + * Enumerable * Enumerable#compact is added. [[Feature #17312]] @@ -457,6 +472,7 @@ See [the repository](https://github.com/ruby/error_highlight) in detail. [Feature #18172]: https://bugs.ruby-lang.org/issues/18172 [Feature #18229]: https://bugs.ruby-lang.org/issues/18229 [Feature #18290]: https://bugs.ruby-lang.org/issues/18290 +[Feature #18273]: https://bugs.ruby-lang.org/issues/18273 [GH-1509]: https://github.com/ruby/ruby/pull/1509 [GH-4815]: https://github.com/ruby/ruby/pull/4815 |