Class: Repeatable::Expression::WeekdayInMonth

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

Instance Method Summary collapse

Methods inherited from Date

#==, #hash, #to_h

Methods inherited from Base

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

Constructor Details

#initialize(weekday:, count:) ⇒ WeekdayInMonth

Returns a new instance of WeekdayInMonth.



4
5
6
7
# File 'lib/repeatable/expression/weekday_in_month.rb', line 4

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

Instance Method Details

#include?(date) ⇒ Boolean

Returns:

  • (Boolean)


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

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