Class: Montrose::Rule::HourOfDay

Inherits:
Object
  • Object
show all
Includes:
Montrose::Rule
Defined in:
lib/montrose/rule/hour_of_day.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Montrose::Rule

#advance!, #continue?, included

Constructor Details

#initialize(hours) ⇒ HourOfDay

Initializes rule

Parameters:

  • hours (Array<Fixnum>)

    valid hours of days, e.g. [1, 2, 24]


15
16
17
# File 'lib/montrose/rule/hour_of_day.rb', line 15

def initialize(hours)
  @hours = hours
end

Class Method Details

.apply_options(opts) ⇒ Object


7
8
9
# File 'lib/montrose/rule/hour_of_day.rb', line 7

def self.apply_options(opts)
  opts[:hour]
end

Instance Method Details

#include?(time) ⇒ Boolean

Returns:

  • (Boolean)

19
20
21
# File 'lib/montrose/rule/hour_of_day.rb', line 19

def include?(time)
  @hours.include?(time.hour)
end