mirror of https://github.com/rails/rails
simplify Class#descendants using singleton_class method
This commit is contained in:
parent
34551bf31e
commit
ce2c4c977c
|
@ -7,7 +7,7 @@ class Class #:nodoc:
|
|||
|
||||
def descendants
|
||||
descendants = []
|
||||
ObjectSpace.each_object(class << self; self; end) do |k|
|
||||
ObjectSpace.each_object(singleton_class) do |k|
|
||||
descendants.unshift k unless k == self
|
||||
end
|
||||
descendants
|
||||
|
|
Loading…
Reference in New Issue