Class: Class

Inherits:
Object
  • Object
show all
Defined in:
lib/specinfra/ext/class.rb

Instance Method Summary collapse

Instance Method Details

#subclassesObject



2
3
4
5
6
7
8
9
10
# File 'lib/specinfra/ext/class.rb', line 2

def subclasses
  result = []
  ObjectSpace.each_object(Class) do |k|
    next unless k < self
    next if k.respond_to?(:singleton_class?) && k.singleton_class?
    result << k
  end
  result
end