Class: Montrose::Rule::During::TimeOfDayRange

Inherits:
Object
  • Object
show all
Defined in:
lib/montrose/rule/during.rb

Instance Method Summary collapse

Constructor Details

#initialize(first, last, exclude_end: false) ⇒ TimeOfDayRange

Returns a new instance of TimeOfDayRange.



25
26
27
28
29
# File 'lib/montrose/rule/during.rb', line 25

def initialize(first, last, exclude_end: false)
  @first = ::Montrose::TimeOfDay.new(first)
  @last = ::Montrose::TimeOfDay.new(last)
  @exclude_end = exclude_end
end

Instance Method Details

#include?(time) ⇒ Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/montrose/rule/during.rb', line 31

def include?(time)
  range.include?(time.seconds_since_midnight.to_i)
end