Class: TallyCounter::KeyGenerate
- Inherits:
-
Object
- Object
- TallyCounter::KeyGenerate
- Defined in:
- lib/tally_counter.rb
Constant Summary collapse
- NAME =
'tally_counter'.freeze
Instance Method Summary collapse
- #for(time, offset = 0) ⇒ Object
-
#initialize(interval, namespace = nil) ⇒ KeyGenerate
constructor
A new instance of KeyGenerate.
Constructor Details
#initialize(interval, namespace = nil) ⇒ KeyGenerate
Returns a new instance of KeyGenerate.
34 35 36 37 |
# File 'lib/tally_counter.rb', line 34 def initialize(interval, namespace = nil) @window = TallyCounter::Window.new(interval) @namespace = namespace end |
Instance Method Details
#for(time, offset = 0) ⇒ Object
41 42 43 44 |
# File 'lib/tally_counter.rb', line 41 def for(time, offset = 0) = @window.floor(time, offset).to_i [@namespace, NAME, ].compact.join(':') end |