Issue #14394 has been updated by fatkodima (Dima Fatko).


I would like the ruby team to reconsider this feature. 

There is a high demand for this and a lot of implementations in the ruby world. Just some of them:
* rails' ActiveSupport - https://github.com/rails/rails/blob/master/activesupport/lib/active_support/descendants_tracker.rb 
* rubocop (3-4 places like this) - https://github.com/rubocop-hq/rubocop/blob/e7197677e919a34ca1587dc1b519c96360249bdc/lib/rubocop/cli/command/base.rb#L15-L18
* rack-attack gem  - https://github.com/rack/rack-attack/blob/129e970d42f86c5c46978988c5c09b0eddaec35a/lib/rack/attack/base_proxy.rb#L9-L15

I have implemented something like this multiple times, personally. And would like to have a standard way to get this.

Are you open for patch?


----------------------------------------
Feature #14394: Class.descendants
https://bugs.ruby-lang.org/issues/14394#change-87227

* Author: ridiculous (Ryan Buckley)
* Status: Open
* Priority: Normal
----------------------------------------
There have been numerous implementations of the method Class.descendants by various gems. However, I can't help but think that this ability should be included in the Ruby language itself. Especially since Ruby already offers the counterpart method Class.ancestors.

Would it possible to add a `descendants` class method?



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>