Class: Montrose::Rule::Until
- Inherits:
-
Object
- Object
- Montrose::Rule::Until
- Includes:
- Montrose::Rule
- Defined in:
- lib/montrose/rule/until.rb
Class Method Summary collapse
Instance Method Summary collapse
- #continue?(_time) ⇒ Boolean
- #include?(time) ⇒ Boolean
-
#initialize(opts) ⇒ Until
constructor
A new instance of Until.
Methods included from Montrose::Rule
Constructor Details
#initialize(opts) ⇒ Until
Returns a new instance of Until.
14 15 16 17 |
# File 'lib/montrose/rule/until.rb', line 14 def initialize(opts) @end_time = opts.fetch(:until) @exclude_end = opts.fetch(:exclude_end) end |
Class Method Details
.apply_options(opts) ⇒ Object
8 9 10 11 12 |
# File 'lib/montrose/rule/until.rb', line 8 def self.(opts) return false unless opts[:until] {until: opts[:until], exclude_end: opts.fetch(:exclude_end, false)} end |
Instance Method Details
#continue?(_time) ⇒ Boolean
27 28 29 |
# File 'lib/montrose/rule/until.rb', line 27 def continue?(_time) false end |
#include?(time) ⇒ Boolean
19 20 21 22 23 24 25 |
# File 'lib/montrose/rule/until.rb', line 19 def include?(time) if @exclude_end time < @end_time else time <= @end_time end end |