instance method
subclasses
Ruby on Rails 6.1.7.10
Since v4.0.13 Last seen in v7.1.6Signature
subclasses()
Returns an array with the direct children of self.
class Foo; end class Bar < Foo; end class Baz < Bar; end Foo.subclasses # => [Bar]
Source
# File activesupport/lib/active_support/core_ext/class/subclasses.rb, line 30
def subclasses
descendants.select { |descendant| descendant.superclass == self }
end
Defined in activesupport/lib/active_support/core_ext/class/subclasses.rb line 30
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Class