Class: Spoom::Counters
- Inherits:
-
Hash
- Object
- Hash
- Spoom::Counters
- Defined in:
- lib/spoom/counters.rb
Overview
: [K = String, V = Integer, Elem = [String, Integer]]
Instance Method Summary collapse
-
#[](key) ⇒ Object
: (String) -> Integer.
-
#increment(key) ⇒ Object
: (String) -> void.
-
#initialize ⇒ Counters
constructor
: -> void.
Constructor Details
#initialize ⇒ Counters
: -> 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 |