module SwedishHolidays
Constants
- DATA_DIR
Public Class Methods
[](date, real: no_arg, include_informal: no_arg)
click to toggle source
# File lib/swedish_holidays.rb, line 10 def [](date, real: no_arg, include_informal: no_arg) informal = Utils.include_informal?(real, include_informal) return Holiday.find(Utils.to_date(date), include_informal: informal) unless date.is_a? Range range = Utils.to_date_range(date) each(start: range.first, include_informal: informal).take_while { |h| range.include? h.date } end
each(start: nil, real: no_arg, include_informal: no_arg, &block)
click to toggle source
# File lib/swedish_holidays.rb, line 24 def each(start: nil, real: no_arg, include_informal: no_arg, &block) informal = Utils.include_informal?(real, include_informal) enumerator = Utils.enumerator(start, informal) return enumerator.lazy unless block_given? enumerator.each(&block) end
holiday?(date = nil, real: no_arg, include_informal: no_arg)
click to toggle source
# File lib/swedish_holidays.rb, line 18 def holiday?(date = nil, real: no_arg, include_informal: no_arg) informal = Utils.include_informal?(real, include_informal) date = Utils.to_date(date) Holiday.holiday?(date, include_informal: informal) end
Private Class Methods
no_arg()
click to toggle source
# File lib/swedish_holidays.rb, line 34 def no_arg Utils::VALUE_NOT_GIVEN end