class Kitchen::Counter

A simple counting object

hehe

Public Class Methods

new() click to toggle source

Creates a new Counter instance

# File lib/kitchen/counter.rb, line 10
def initialize
  reset
end

Public Instance Methods

get() click to toggle source

Returns the value of the counter

@return [Integer]

# File lib/kitchen/counter.rb, line 29
def get
  @value
end
inc(by: 1)

@!method inc

@see increment
Alias for: increment
increment(by: 1) click to toggle source

Increase the value of the counter

@param by [Integer] the amount to increase by

# File lib/kitchen/counter.rb, line 18
def increment(by: 1)
  @value += by
end
Also aliased as: inc
reset(to: 0) click to toggle source

Reset the value of the counter

@param to [Integer] the value to reset to

# File lib/kitchen/counter.rb, line 36
def reset(to: 0)
  @value = to
end