Module: LogicalFriday::Included

Included in:
LogicalFriday
Defined in:
lib/logical_friday/included.rb

Class Method Summary collapse

Class Method Details

.included(mod) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/logical_friday/included.rb', line 6

def self.included(mod)
  Date.class_eval do
    define_method :logical_friday? do
      saturday_in_this_week = self + (6 - wday)

      friday? || (self.next_day..saturday_in_this_week.prev_day).all? { |it| HolidayJp.holiday?(it) != nil }
    end
  end
end