Class: Montrose::Rule::DayOfMonth

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

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Montrose::Rule

#advance!, #continue?, included

Constructor Details

#initialize(days) ⇒ DayOfMonth

Initializes rule

Parameters:

  • days (Array<Fixnum>)
    • valid days of month, i.e. [1, 2, -1]


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

def initialize(days)
  @days = days
end

Class Method Details

.apply_options(opts) ⇒ Object


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

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

Instance Method Details

#include?(time) ⇒ Boolean

Returns:

  • (Boolean)

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

def include?(time)
  @days.include?(time.mday) || included_from_end_of_month?(time)
end