Class: Repeatable::Expression::WeekdayInMonth

Inherits:
Date
  • Object
show all
Includes:
LastDateOfMonth
Defined in:
lib/repeatable/expression/weekday_in_month.rb

Instance Method Summary collapse

Methods included from LastDateOfMonth

#last_date_of_month

Methods inherited from Date

#==, #hash

Methods inherited from Base

===, #deconstruct_keys, #difference, #intersection, #to_h, #union

Constructor Details

#initialize(weekday:, count:) ⇒ void

Parameters:

  • weekday (Integer)
  • count (Integer)


9
10
11
12
# File 'lib/repeatable/expression/weekday_in_month.rb', line 9

def initialize(weekday:, count:)
  @weekday = weekday
  @count = count
end

Instance Method Details

#include?(date) ⇒ Boolean

Parameters:

  • date (::Date)

Returns:

  • (Boolean)


15
16
17
# File 'lib/repeatable/expression/weekday_in_month.rb', line 15

def include?(date)
  day_matches?(date) && week_matches?(date)
end