Class: Reek::Context::StatementCounter

Inherits:
Object
  • Object
show all
Defined in:
lib/reek/context/statement_counter.rb

Overview

Responsible for counting the statements in a ‘CodeContext`.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeStatementCounter

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

#valueObject

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