Class: Wildsight::Metrics::Counter

Inherits:
Object
  • Object
show all
Defined in:
lib/wildsight/metrics/counter.rb

Instance Method Summary collapse

Constructor Details

#initialize(value = 0) ⇒ Counter

Returns a new instance of Counter.



6
7
8
# File 'lib/wildsight/metrics/counter.rb', line 6

def initialize(value = 0)
  set(value)
end

Instance Method Details

#inc(value = 1) ⇒ Object



10
11
12
# File 'lib/wildsight/metrics/counter.rb', line 10

def inc(value = 1)
  @value += value
end

#set(value = 0) ⇒ Object



14
15
16
# File 'lib/wildsight/metrics/counter.rb', line 14

def set(value = 0)
  @value = value
end