Class: Module

Inherits:
Object show all
Defined in:
lib/stratagem/extensions/module.rb

Instance Method Summary collapse

Instance Method Details

#subclassesObject



2
3
4
5
6
7
8
9
10
# File 'lib/stratagem/extensions/module.rb', line 2

def subclasses
  classes = []
  ObjectSpace.each_object(Class) do |c|
    next unless c.superclass == self || c.ancestors.include?(self)
    next if c == self
    classes << c
  end
  classes
end