Class: Spoom::Counters

Inherits:
Hash
  • Object
show all
Defined in:
lib/spoom/counters.rb

Overview

: [K = String, V = Integer, Elem = [String, Integer]]

Instance Method Summary collapse

Constructor Details

#initializeCounters

: -> void



8
9
10
# File 'lib/spoom/counters.rb', line 8

def initialize
  super(0)
end

Instance Method Details

#[](key) ⇒ Object

: (String) -> Integer



18
19
20
# File 'lib/spoom/counters.rb', line 18

def [](key)
  super(key) #: as Integer
end

#increment(key) ⇒ Object

: (String) -> void



13
14
15
# File 'lib/spoom/counters.rb', line 13

def increment(key)
  self[key] += 1
end