module LogicalFriday::Included

Public Class Methods

included(mod) click to toggle source
# 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