Class: Reek::Context::StatementCounter
- Inherits:
-
Object
- Object
- Reek::Context::StatementCounter
- Defined in:
- lib/reek/context/statement_counter.rb
Overview
Responsible for counting the statements in a ‘CodeContext`.
Instance Attribute Summary collapse
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #decrease_by(number) ⇒ Object
- #increase_by(sexp) ⇒ Object
-
#initialize ⇒ StatementCounter
constructor
A new instance of StatementCounter.
Constructor Details
#initialize ⇒ StatementCounter
Returns a new instance of StatementCounter.
11 12 13 |
# File 'lib/reek/context/statement_counter.rb', line 11 def initialize @value = 0 end |
Instance Attribute Details
#value ⇒ Object
Returns the value of attribute value.
9 10 11 |
# File 'lib/reek/context/statement_counter.rb', line 9 def value @value end |
Instance Method Details
#decrease_by(number) ⇒ Object
19 20 21 |
# File 'lib/reek/context/statement_counter.rb', line 19 def decrease_by(number) self.value = value - number end |
#increase_by(sexp) ⇒ Object
15 16 17 |
# File 'lib/reek/context/statement_counter.rb', line 15 def increase_by(sexp) self.value = value + sexp.length if sexp end |