Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/object.rb
Class Method Summary collapse
Class Method Details
.subclasses(direct = false) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/object.rb', line 2 def self.subclasses(direct = false) classes = [] if direct ObjectSpace.each_object(Class) do |c| next unless c.superclass == self classes << c end else ObjectSpace.each_object(Class) do |c| next unless c.ancestors.include?(self) and (c != self) classes << c end end classes end |