Class: ImproveYourCode::Context::StatementCounter

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeStatementCounter

Returns a new instance of StatementCounter.



10
11
12
# File 'lib/improve_your_code/context/statement_counter.rb', line 10

def initialize
  @value = 0
end

Instance Attribute Details

#valueObject

Returns the value of attribute value.



8
9
10
# File 'lib/improve_your_code/context/statement_counter.rb', line 8

def value
  @value
end

Instance Method Details

#decrease_by(number) ⇒ Object



18
19
20
# File 'lib/improve_your_code/context/statement_counter.rb', line 18

def decrease_by(number)
  self.value = value - number
end

#increase_by(sexp) ⇒ Object



14
15
16
# File 'lib/improve_your_code/context/statement_counter.rb', line 14

def increase_by(sexp)
  self.value = value + sexp.length if sexp
end