Skip to content

Commit

Permalink
remove :nodoc: from Class#subclasses [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
Francesco Rodriguez committed May 28, 2012
1 parent ca65dcb commit 0ad2146
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions activesupport/lib/active_support/core_ext/class/subclasses.rb
@@ -1,19 +1,19 @@
require 'active_support/core_ext/module/anonymous'
require 'active_support/core_ext/module/reachable'

class Class #:nodoc:
class Class
begin
ObjectSpace.each_object(Class.new) {}

def descendants
def descendants # :nodoc:
descendants = []
ObjectSpace.each_object(singleton_class) do |k|
descendants.unshift k unless k == self
end
descendants
end
rescue StandardError # JRuby
def descendants
def descendants # :nodoc:
descendants = []
ObjectSpace.each_object(Class) do |k|
descendants.unshift k if k < self
Expand All @@ -25,7 +25,13 @@ def descendants

# Returns an array with the direct children of +self+.
#
# Integer.subclasses # => [Bignum, Fixnum]
# Integer.subclasses # => [Fixnum, Bignum]
#
# class Foo; end
# class Bar < Foo; end
# class Baz < Foo; end
#
# Foo.subclasses # => [Baz, Bar]
def subclasses
subclasses, chain = [], descendants
chain.each do |k|
Expand Down

0 comments on commit 0ad2146

Please sign in to comment.