Class: ImproveYourCode::Context::StatementCounter
- Inherits:
-
Object
- Object
- ImproveYourCode::Context::StatementCounter
- Defined in:
- lib/improve_your_code/context/statement_counter.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
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.
10 11 12 |
# File 'lib/improve_your_code/context/statement_counter.rb', line 10 def initialize @value = 0 end |
Instance Attribute Details
#value ⇒ Object
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 |