Class: Stats
- Inherits:
-
Object
- Object
- Stats
- Defined in:
- lib/pimon/stats.rb
Instance Method Summary collapse
- #index(queue, index) ⇒ Object
-
#initialize(queues) ⇒ Stats
constructor
A new instance of Stats.
- #push(queue, value) ⇒ Object
- #range(queue) ⇒ Object
- #shift(queue) ⇒ Object
Constructor Details
#initialize(queues) ⇒ Stats
Returns a new instance of Stats.
3 4 5 6 7 8 |
# File 'lib/pimon/stats.rb', line 3 def initialize(queues) @stats = {} queues.each do |queue| @stats[queue] = [] end end |
Instance Method Details
#index(queue, index) ⇒ Object
10 11 12 |
# File 'lib/pimon/stats.rb', line 10 def index(queue, index) @stats[queue][index] end |
#push(queue, value) ⇒ Object
14 15 16 |
# File 'lib/pimon/stats.rb', line 14 def push(queue, value) @stats[queue].push(value) end |
#range(queue) ⇒ Object
22 23 24 |
# File 'lib/pimon/stats.rb', line 22 def range(queue) @stats[queue] end |
#shift(queue) ⇒ Object
18 19 20 |
# File 'lib/pimon/stats.rb', line 18 def shift(queue) @stats[queue].shift end |