1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

simplify Class#descendants using singleton_class method

This commit is contained in:
Sergey Nartimov 2012-01-04 21:51:39 +03:00
parent 34551bf31e
commit ce2c4c977c

View file

@ -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