Class: Montrose::Rule::WeekOfYear

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

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Montrose::Rule

#advance!, #continue?, included

Constructor Details

#initialize(weeks) ⇒ WeekOfYear

Initializes rule

Parameters:

  • weeks (Array[Fixnum])
    • valid weeks of year



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

def initialize(weeks)
  @weeks = weeks
end

Class Method Details

.apply_options(opts) ⇒ Object



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

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

Instance Method Details

#include?(time) ⇒ Boolean

Returns:

  • (Boolean)


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

def include?(time)
  @weeks.include?(time.to_date.cweek)
end