Class: Cycromatic::Calculator
- Inherits:
-
Object
- Object
- Cycromatic::Calculator
- Defined in:
- lib/cycromatic/calculator.rb
Instance Attribute Summary collapse
-
#node ⇒ Object
readonly
Returns the value of attribute node.
Instance Method Summary collapse
- #each_complexity(&block) ⇒ Object
-
#initialize(node:) ⇒ Calculator
constructor
A new instance of Calculator.
Constructor Details
#initialize(node:) ⇒ Calculator
Returns a new instance of Calculator.
5 6 7 |
# File 'lib/cycromatic/calculator.rb', line 5 def initialize(node:) @node = node end |
Instance Attribute Details
#node ⇒ Object (readonly)
Returns the value of attribute node.
3 4 5 |
# File 'lib/cycromatic/calculator.rb', line 3 def node @node end |
Instance Method Details
#each_complexity(&block) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/cycromatic/calculator.rb', line 9 def each_complexity(&block) if block_given? calculate_toplevel node, &block else enum_for :each_complexity end end |