Class: Montrose::Rule::DayOfWeek

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

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Montrose::Rule

#advance!, #continue?, included

Constructor Details

#initialize(days) ⇒ DayOfWeek

Initializes rule

Parameters:

  • days (Array<Fixnum>)
    • valid days of week, e.g. [1, 2, 7]



16
17
18
# File 'lib/montrose/rule/day_of_week.rb', line 16

def initialize(days)
  @days = days
end

Class Method Details

.apply_options(opts) ⇒ Object



8
9
10
# File 'lib/montrose/rule/day_of_week.rb', line 8

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

Instance Method Details

#include?(time) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/montrose/rule/day_of_week.rb', line 20

def include?(time)
  @days.include?(time.wday)
end