class NationalHolidays
Constants
- UnknownCountryError
- UnknownRegionError
Public Class Methods
config_directory()
click to toggle source
# File lib/national_holidays.rb, line 29 def self.config_directory File.expand_path('../national-holidays-config/conf', __dir__) end
countries()
click to toggle source
# File lib/national_holidays.rb, line 15 def self.countries Country.all end
load!()
click to toggle source
# File lib/national_holidays.rb, line 10 def self.load! Region.all.each(&:name) true end
regions()
click to toggle source
# File lib/national_holidays.rb, line 19 def self.regions Region.all end
regions_to_public_holiday_count_for_year(year)
click to toggle source
# File lib/national_holidays.rb, line 23 def self.regions_to_public_holiday_count_for_year(year) Region.all.sort_by(&:code).map do |region| [region.code, region.holidays_between(Date.new(year, 1, 1), Date.new(year, 12, 31)).count] end.to_h end