[ruby-core:99732] [Ruby master Feature#14394] Class.descendants
From:
fatkodima123@...
Date:
2020-08-27 15:37:54 UTC
List:
ruby-core #99732
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:[email protected]?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>