Class: Tailstrom::CounterCollection
- Inherits:
-
Object
- Object
- Tailstrom::CounterCollection
- Defined in:
- lib/tailstrom/counter_collection.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
- #clear ⇒ Object
- #each(&block) ⇒ Object
- #empty? ⇒ Boolean
-
#initialize ⇒ CounterCollection
constructor
A new instance of CounterCollection.
- #keys ⇒ Object
- #size ⇒ Object
- #to_a ⇒ Object
Constructor Details
#initialize ⇒ CounterCollection
Returns a new instance of CounterCollection.
5 6 7 |
# File 'lib/tailstrom/counter_collection.rb', line 5 def initialize clear end |
Instance Method Details
#[](key) ⇒ Object
13 14 15 |
# File 'lib/tailstrom/counter_collection.rb', line 13 def [](key) @counters[key] end |
#clear ⇒ Object
9 10 11 |
# File 'lib/tailstrom/counter_collection.rb', line 9 def clear @counters = Hash.new {|h, k| h[k] = Counter.new } end |
#each(&block) ⇒ Object
21 22 23 |
# File 'lib/tailstrom/counter_collection.rb', line 21 def each(&block) @counters.each &block end |
#empty? ⇒ Boolean
17 18 19 |
# File 'lib/tailstrom/counter_collection.rb', line 17 def empty? @counters.empty? end |
#keys ⇒ Object
33 34 35 |
# File 'lib/tailstrom/counter_collection.rb', line 33 def keys @counters.keys end |
#size ⇒ Object
29 30 31 |
# File 'lib/tailstrom/counter_collection.rb', line 29 def size @counters.size end |
#to_a ⇒ Object
25 26 27 |
# File 'lib/tailstrom/counter_collection.rb', line 25 def to_a @counters.to_a end |