Class: Module

Inherits:
Object show all
Defined in:
lib/sapphire/Extensions/Module.rb

Direct Known Subclasses

Class

Instance Method Summary collapse

Instance Method Details

#sub_classesObject



8
9
10
# File 'lib/sapphire/Extensions/Module.rb', line 8

def sub_classes
  self.constants.select {|c| Class === self.const_get(c)}
end

#sub_modulesObject



2
3
4
5
6
# File 'lib/sapphire/Extensions/Module.rb', line 2

def sub_modules
  [self] + constants.map {|const| const_get(const) }
  .select {|const| const.is_a? Module }
  .flat_map {|const| const.sub_modules }
end