Class: Weeter::Limitator::TimeWindow
- Inherits:
-
Object
- Object
- Weeter::Limitator::TimeWindow
- Defined in:
- lib/weeter/limitator.rb
Instance Method Summary collapse
- #begin_new_window(at) ⇒ Object
-
#initialize(options = {}) ⇒ TimeWindow
constructor
A new instance of TimeWindow.
- #over?(time) ⇒ Boolean
Constructor Details
#initialize(options = {}) ⇒ TimeWindow
Returns a new instance of TimeWindow.
18 19 20 21 |
# File 'lib/weeter/limitator.rb', line 18 def initialize( = {}) @start = .fetch(:start) @duration = .fetch(:duration) end |
Instance Method Details
#begin_new_window(at) ⇒ Object
27 28 29 |
# File 'lib/weeter/limitator.rb', line 27 def begin_new_window(at) @start = at end |
#over?(time) ⇒ Boolean
23 24 25 |
# File 'lib/weeter/limitator.rb', line 23 def over?(time) time - @start > @duration end |