class Montrose::Rule::Until

Public Class Methods

apply_options(opts) click to toggle source
# File lib/montrose/rule/until.rb, line 8
def self.apply_options(opts)
  return false unless opts[:until]

  {until: opts[:until], exclude_end: opts.fetch(:exclude_end, false)}
end
new(opts) click to toggle source
# File lib/montrose/rule/until.rb, line 14
def initialize(opts)
  @end_time = opts.fetch(:until)
  @exclude_end = opts.fetch(:exclude_end)
end

Public Instance Methods

continue?(_time) click to toggle source
# File lib/montrose/rule/until.rb, line 27
def continue?(_time)
  false
end
include?(time) click to toggle source
# File lib/montrose/rule/until.rb, line 19
def include?(time)
  if @exclude_end
    time < @end_time
  else
    time <= @end_time
  end
end