Class: MOSAIK::Metrics::ABCSize::Processor
- Inherits:
-
AST::Processor
- Object
- AST::Processor
- MOSAIK::Metrics::ABCSize::Processor
- Defined in:
- lib/mosaik/metrics/abc_size/processor.rb
Overview
Abstract Syntax Tree parser for Ruby code
Instance Attribute Summary collapse
-
#abc_sizes ⇒ Object
readonly
Returns the value of attribute abc_sizes.
Instance Method Summary collapse
-
#initialize ⇒ Processor
constructor
A new instance of Processor.
-
#on_def(node) ⇒ Object
Instance methods.
-
#on_defs(node) ⇒ Object
Class methods.
Constructor Details
#initialize ⇒ Processor
Returns a new instance of Processor.
14 15 16 17 18 19 |
# File 'lib/mosaik/metrics/abc_size/processor.rb', line 14 def initialize super # Initialize ABC sizes @abc_sizes = {} end |
Instance Attribute Details
#abc_sizes ⇒ Object (readonly)
Returns the value of attribute abc_sizes.
12 13 14 |
# File 'lib/mosaik/metrics/abc_size/processor.rb', line 12 def abc_sizes @abc_sizes end |
Instance Method Details
#on_def(node) ⇒ Object
Instance methods
22 23 24 25 26 27 |
# File 'lib/mosaik/metrics/abc_size/processor.rb', line 22 def on_def(node) method_name = node.children[0].to_s # Calculate and store ABC size for the method abc_sizes[method_name] = abc_size_for(node) end |
#on_defs(node) ⇒ Object
Class methods
30 31 32 33 34 35 |
# File 'lib/mosaik/metrics/abc_size/processor.rb', line 30 def on_defs(node) method_name = "self.#{node.children[1]}" # Calculate and store ABC size for the method abc_sizes[method_name] = abc_size_for(node) end |