forked from wearemolecule/holidays
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Define holidays in methods instead of constants
- Loading branch information
Showing
32 changed files
with
814 additions
and
686 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,41 @@ | ||
# encoding: utf-8 | ||
module Holidays | ||
# This file is generated by the Ruby Holiday gem. | ||
# This file is generated by the Ruby Holidays gem. | ||
# | ||
# Definitions loaded: data/at.yaml | ||
# | ||
# To use the definitions in this file, load them right after you load the | ||
# To use the definitions in this file, load it right after you load the | ||
# Holiday gem: | ||
# | ||
# require 'holidays' | ||
# require 'holidays/at' | ||
# | ||
# More definitions are available at http://code.dunae.ca/holidays. | ||
# All the definitions are available at https://github.com/alexdunae/holidays | ||
module AT # :nodoc: | ||
DEFINED_REGIONS = [:at] | ||
def self.defined_regions | ||
[:at] | ||
end | ||
|
||
HOLIDAYS_BY_MONTH = { | ||
def self.holidays_by_month | ||
{ | ||
5 => [{:mday => 1, :name => "Staatsfeiertag", :regions => [:at]}], | ||
0 => [{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Ostermontag", :regions => [:at]}, | ||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Christi Himmelfahrt", :regions => [:at]}, | ||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Pfingstmontag", :regions => [:at]}, | ||
{:function => lambda { |year| Holidays.easter(year)+60 }, :function_id => "easter(year)+60", :name => "Fronleichnam", :regions => [:at]}], | ||
11 => [{:mday => 1, :name => "Allerheiligen", :regions => [:at]}], | ||
1 => [{:mday => 1, :name => "Neujahrstag", :regions => [:at]}, | ||
{:mday => 6, :name => "Heilige Drei Könige", :regions => [:at]}], | ||
5 => [{:mday => 1, :name => "Staatsfeiertag", :regions => [:at]}], | ||
8 => [{:mday => 15, :name => "Mariä Himmelfahrt", :regions => [:at]}], | ||
10 => [{:mday => 26, :name => "Nationalfeiertag", :regions => [:at]}], | ||
11 => [{:mday => 1, :name => "Allerheiligen", :regions => [:at]}], | ||
12 => [{:mday => 8, :name => "Mariä Empfängnis", :regions => [:at]}, | ||
{:mday => 25, :name => "1. Weihnachtstag", :regions => [:at]}, | ||
{:mday => 26, :name => "2. Weihnachtstag", :regions => [:at]}] | ||
} | ||
{:mday => 26, :name => "2. Weihnachtstag", :regions => [:at]}], | ||
8 => [{:mday => 15, :name => "Mariä Himmelfahrt", :regions => [:at]}], | ||
10 => [{:mday => 26, :name => "Nationalfeiertag", :regions => [:at]}] | ||
} | ||
end | ||
end | ||
|
||
|
||
end | ||
|
||
Holidays.merge_defs(Holidays::AT::DEFINED_REGIONS, Holidays::AT::HOLIDAYS_BY_MONTH) | ||
Holidays.merge_defs(Holidays::AT.defined_regions, Holidays::AT.holidays_by_month) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,47 @@ | ||
# encoding: utf-8 | ||
module Holidays | ||
# This file is generated by the Ruby Holiday gem. | ||
# This file is generated by the Ruby Holidays gem. | ||
# | ||
# Definitions loaded: data/au.yaml | ||
# | ||
# To use the definitions in this file, load them right after you load the | ||
# To use the definitions in this file, load it right after you load the | ||
# Holiday gem: | ||
# | ||
# require 'holidays' | ||
# require 'holidays/au' | ||
# | ||
# More definitions are available at http://code.dunae.ca/holidays. | ||
# All the definitions are available at https://github.com/alexdunae/holidays | ||
module AU # :nodoc: | ||
DEFINED_REGIONS = [:au, :au_tas, :au_wa, :au_vic, :au_qld, :au_nt, :au_act, :au_nsw, :au_sa, :au_qld_brisbane] | ||
def self.defined_regions | ||
[:au_qld, :au_nt, :au, :au_tas, :au_wa, :au_act, :au_nsw, :au_sa, :au_vic, :au_qld_brisbane] | ||
end | ||
|
||
HOLIDAYS_BY_MONTH = { | ||
def self.holidays_by_month | ||
{ | ||
5 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:au_qld]}, | ||
{:wday => 1, :week => 1, :name => "May Day", :regions => [:au_nt]}], | ||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:au]}, | ||
{:function => lambda { |year| Holidays.easter(year)-1 }, :function_id => "easter(year)-1", :name => "Easter Saturday", :regions => [:au]}, | ||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Easter Monday", :regions => [:au]}, | ||
{:function => lambda { |year| Holidays.easter(year)+2 }, :function_id => "easter(year)+2", :name => "Easter Monday", :regions => [:au_tas]}], | ||
6 => [{:wday => 1, :week => 1, :name => "Foundation Day", :regions => [:au_wa]}, | ||
{:wday => 1, :week => 2, :name => "Queen's Birthday", :regions => [:au_act, :au_nsw, :au_sa, :au_tas, :au_nt, :au_qld, :au_vic]}, | ||
{:mday => 6, :type => :informal, :name => "Queensland Day", :regions => [:au_qld]}], | ||
1 => [{:mday => 1, :name => "New Year's Day", :regions => [:au]}, | ||
{:mday => 26, :name => "Australia Day", :regions => [:au]}], | ||
12 => [{:mday => 25, :name => "Christmas Day", :regions => [:au]}, | ||
{:mday => 26, :name => "Boxing Day", :regions => [:au]}], | ||
8 => [{:wday => 3, :week => -3, :name => "Ekka", :regions => [:au_qld_brisbane]}], | ||
3 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:au_wa]}, | ||
{:wday => 1, :week => 2, :name => "Eight Hours Day", :regions => [:au_tas]}, | ||
{:wday => 1, :week => 2, :name => "Labour Day", :regions => [:au_vic]}], | ||
4 => [{:mday => 25, :name => "ANZAC Day", :regions => [:au]}], | ||
5 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:au_qld]}, | ||
{:wday => 1, :week => 1, :name => "May Day", :regions => [:au_nt]}], | ||
6 => [{:wday => 1, :week => 1, :name => "Foundation Day", :regions => [:au_wa]}, | ||
{:wday => 1, :week => 2, :name => "Queen's Birthday", :regions => [:au_act, :au_nsw, :au_sa, :au_tas, :au_nt, :au_qld, :au_vic]}, | ||
{:mday => 6, :type => :informal, :name => "Queensland Day", :regions => [:au_qld]}], | ||
8 => [{:wday => 3, :week => -3, :name => "Ekka", :regions => [:au_qld_brisbane]}], | ||
10 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:au_act, :au_nsw, :au_sa]}], | ||
12 => [{:mday => 25, :name => "Christmas Day", :regions => [:au]}, | ||
{:mday => 26, :name => "Boxing Day", :regions => [:au]}] | ||
} | ||
10 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:au_act, :au_nsw, :au_sa]}] | ||
} | ||
end | ||
end | ||
|
||
|
||
end | ||
|
||
Holidays.merge_defs(Holidays::AU::DEFINED_REGIONS, Holidays::AU::HOLIDAYS_BY_MONTH) | ||
Holidays.merge_defs(Holidays::AU.defined_regions, Holidays::AU.holidays_by_month) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,40 @@ | ||
# encoding: utf-8 | ||
module Holidays | ||
# This file is generated by the Ruby Holiday gem. | ||
# This file is generated by the Ruby Holidays gem. | ||
# | ||
# Definitions loaded: data/br.yaml | ||
# | ||
# To use the definitions in this file, load them right after you load the | ||
# To use the definitions in this file, load it right after you load the | ||
# Holiday gem: | ||
# | ||
# require 'holidays' | ||
# require 'holidays/br' | ||
# | ||
# More definitions are available at http://code.dunae.ca/holidays. | ||
# All the definitions are available at https://github.com/alexdunae/holidays | ||
module BR # :nodoc: | ||
DEFINED_REGIONS = [:br] | ||
def self.defined_regions | ||
[:br] | ||
end | ||
|
||
HOLIDAYS_BY_MONTH = { | ||
def self.holidays_by_month | ||
{ | ||
5 => [{:mday => 1, :name => "Dia do Trabalho", :regions => [:br]}], | ||
0 => [{:function => lambda { |year| Holidays.easter(year)-47 }, :function_id => "easter(year)-47", :type => :informal, :name => "Carnaval", :regions => [:br]}, | ||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Sexta-feira Santa", :regions => [:br]}, | ||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Páscoa", :regions => [:br]}, | ||
{:function => lambda { |year| Holidays.easter(year)+60 }, :function_id => "easter(year)+60", :name => "Corpus Christ", :regions => [:br]}], | ||
1 => [{:mday => 1, :name => "Dia da Confraternização Universal", :regions => [:br]}], | ||
4 => [{:mday => 21, :name => "Dia de Tiradentes", :regions => [:br]}], | ||
5 => [{:mday => 1, :name => "Dia do Trabalho", :regions => [:br]}], | ||
9 => [{:mday => 7, :name => "Proclamação da Independência", :regions => [:br]}], | ||
10 => [{:mday => 12, :name => "Dia de Nossa Senhora Aparecida", :regions => [:br]}], | ||
11 => [{:mday => 2, :name => "Dia de Finados", :regions => [:br]}, | ||
{:mday => 15, :name => "Proclamação da República", :regions => [:br]}], | ||
12 => [{:mday => 25, :name => "Natal", :regions => [:br]}] | ||
} | ||
1 => [{:mday => 1, :name => "Dia da Confraternização Universal", :regions => [:br]}], | ||
12 => [{:mday => 25, :name => "Natal", :regions => [:br]}], | ||
9 => [{:mday => 7, :name => "Proclamação da Independência", :regions => [:br]}], | ||
4 => [{:mday => 21, :name => "Dia de Tiradentes", :regions => [:br]}], | ||
10 => [{:mday => 12, :name => "Dia de Nossa Senhora Aparecida", :regions => [:br]}] | ||
} | ||
end | ||
end | ||
|
||
|
||
end | ||
|
||
Holidays.merge_defs(Holidays::BR::DEFINED_REGIONS, Holidays::BR::HOLIDAYS_BY_MONTH) | ||
Holidays.merge_defs(Holidays::BR.defined_regions, Holidays::BR.holidays_by_month) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,40 @@ | ||
# encoding: utf-8 | ||
module Holidays | ||
# This file is generated by the Ruby Holiday gem. | ||
# This file is generated by the Ruby Holidays gem. | ||
# | ||
# Definitions loaded: data/cz.yaml | ||
# | ||
# To use the definitions in this file, load them right after you load the | ||
# To use the definitions in this file, load it right after you load the | ||
# Holiday gem: | ||
# | ||
# require 'holidays' | ||
# require 'holidays/cz' | ||
# | ||
# More definitions are available at http://code.dunae.ca/holidays. | ||
# All the definitions are available at https://github.com/alexdunae/holidays | ||
module CZ # :nodoc: | ||
DEFINED_REGIONS = [:cz] | ||
def self.defined_regions | ||
[:cz] | ||
end | ||
|
||
HOLIDAYS_BY_MONTH = { | ||
def self.holidays_by_month | ||
{ | ||
5 => [{:mday => 1, :name => "Svátek práce", :regions => [:cz]}, | ||
{:mday => 8, :name => "Den vítězství", :regions => [:cz]}], | ||
0 => [{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Velikonoční pondělí", :regions => [:cz]}], | ||
11 => [{:mday => 17, :name => "Den boje za svobodu a demokracii", :regions => [:cz]}], | ||
1 => [{:mday => 1, :name => "Den obnovy samostatného českého státu", :regions => [:cz]}], | ||
5 => [{:mday => 1, :name => "Svátek práce", :regions => [:cz]}, | ||
{:mday => 8, :name => "Den vítězství", :regions => [:cz]}], | ||
12 => [{:mday => 24, :name => "Štědrý den", :regions => [:cz]}, | ||
{:mday => 25, :name => "1. svátek vánoční", :regions => [:cz]}, | ||
{:mday => 26, :name => "2. svátek vánoční", :regions => [:cz]}], | ||
7 => [{:mday => 5, :name => "Den slovanských věrozvěstů Cyrila a Metoděje", :regions => [:cz]}, | ||
{:mday => 6, :name => "Den upálení mistra Jana Husa", :regions => [:cz]}], | ||
9 => [{:mday => 28, :name => "Den české státnosti", :regions => [:cz]}], | ||
10 => [{:mday => 28, :name => "Den vzniku samostatného československého státu", :regions => [:cz]}], | ||
11 => [{:mday => 17, :name => "Den boje za svobodu a demokracii", :regions => [:cz]}], | ||
12 => [{:mday => 24, :name => "Štědrý den", :regions => [:cz]}, | ||
{:mday => 25, :name => "1. svátek vánoční", :regions => [:cz]}, | ||
{:mday => 26, :name => "2. svátek vánoční", :regions => [:cz]}] | ||
} | ||
10 => [{:mday => 28, :name => "Den vzniku samostatného československého státu", :regions => [:cz]}] | ||
} | ||
end | ||
end | ||
|
||
|
||
end | ||
|
||
Holidays.merge_defs(Holidays::CZ::DEFINED_REGIONS, Holidays::CZ::HOLIDAYS_BY_MONTH) | ||
Holidays.merge_defs(Holidays::CZ.defined_regions, Holidays::CZ.holidays_by_month) |
Oops, something went wrong.