Class: MOSAIK::Extractors::Structural
- Inherits:
-
MOSAIK::Extractor
- Object
- MOSAIK::Extractor
- MOSAIK::Extractors::Structural
- Defined in:
- lib/mosaik/extractors/structural.rb,
lib/mosaik/extractors/structural/parser.rb,
lib/mosaik/extractors/structural/processor.rb
Overview
Structural coupling extractor
Defined Under Namespace
Instance Attribute Summary
Attributes inherited from MOSAIK::Extractor
Instance Method Summary collapse
Methods inherited from MOSAIK::Extractor
Constructor Details
This class inherits a constructor from MOSAIK::Extractor
Instance Method Details
#call ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/mosaik/extractors/structural.rb', line 9 def call # Instantiate a constant tree tree = Syntax::Tree.new # Parse files MOSAIK.configuration.files.each do |file| Parser .new .parse(file, tree) end # Count total constants and methods total = tree.to_h { |c| [c.name, c.methods.size] } info "Parsed #{total.size} classes and #{total.values.sum} methods" # Print the constant tree tree.each do |constant| debug constant constant.methods.each_value do |method| debug " #{method}" method.references.each do |reference| debug " #{reference}" end end # Print the hierarchy debug (" " * constant.name.scan("::").size) + constant.name end # Construct the graph tree.each { |constant| construct(constant) } # rubocop:disable Style/CombinableLoops end |