Skip to content

Commit a61bac3

Browse files
authored
Merge pull request rails#43481 from byroot/native-class-descendants
Use the native `Class#descendants` if available
2 parents bd400b4 + d8936b7 commit a61bac3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

activesupport/lib/active_support/core_ext/class/subclasses.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def descendants
1818
ObjectSpace.each_object(singleton_class).reject do |k|
1919
k.singleton_class? || k == self
2020
end
21-
end
21+
end unless method_defined?(:descendants) # RUBY_VERSION >= "3.1"
2222

2323
# Returns an array with the direct children of +self+.
2424
#

0 commit comments

Comments
 (0)