Class: Spoom::Counters
- Inherits:
-
Hash
- Object
- Hash
- Spoom::Counters
- Defined in:
- lib/spoom/counters.rb
Overview
Instance Method Summary collapse
- #[](key) ⇒ Object
- #increment(key) ⇒ Object
-
#initialize ⇒ Counters
constructor
A new instance of Counters.
Constructor Details
#initialize ⇒ Counters
Returns a new instance of Counters.
8 9 10 |
# File 'lib/spoom/counters.rb', line 8 def initialize super(0) end |
Instance Method Details
#[](key) ⇒ Object
18 19 20 |
# File 'lib/spoom/counters.rb', line 18 def [](key) super(key) #: as Integer end |
#increment(key) ⇒ Object
13 14 15 |
# File 'lib/spoom/counters.rb', line 13 def increment(key) self[key] += 1 end |