holidays 6.6.1 → 7.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/lib/generated_definitions/MANIFEST +7 -5
- data/lib/generated_definitions/REGIONS.rb +2 -2
- data/lib/generated_definitions/ar.rb +2 -2
- data/lib/generated_definitions/at.rb +2 -2
- data/lib/generated_definitions/au.rb +2 -2
- data/lib/generated_definitions/be_fr.rb +2 -2
- data/lib/generated_definitions/be_nl.rb +2 -2
- data/lib/generated_definitions/bg.rb +2 -2
- data/lib/generated_definitions/br.rb +2 -2
- data/lib/generated_definitions/ca.rb +5 -4
- data/lib/generated_definitions/ch.rb +2 -2
- data/lib/generated_definitions/cl.rb +2 -2
- data/lib/generated_definitions/co.rb +2 -2
- data/lib/generated_definitions/cr.rb +2 -2
- data/lib/generated_definitions/cz.rb +2 -2
- data/lib/generated_definitions/de.rb +2 -2
- data/lib/generated_definitions/dk.rb +2 -2
- data/lib/generated_definitions/{ecb_target.rb → ecbtarget.rb} +10 -10
- data/lib/generated_definitions/ee.rb +2 -2
- data/lib/generated_definitions/el.rb +2 -2
- data/lib/generated_definitions/es.rb +2 -2
- data/lib/generated_definitions/europe.rb +26 -13
- data/lib/generated_definitions/{federal_reserve.rb → federalreserve.rb} +14 -14
- data/lib/generated_definitions/federalreservebanks.rb +34 -0
- data/lib/generated_definitions/fedex.rb +2 -2
- data/lib/generated_definitions/fi.rb +2 -2
- data/lib/generated_definitions/fr.rb +2 -2
- data/lib/generated_definitions/gb.rb +2 -2
- data/lib/generated_definitions/ge.rb +2 -2
- data/lib/generated_definitions/hk.rb +2 -2
- data/lib/generated_definitions/hr.rb +2 -2
- data/lib/generated_definitions/hu.rb +2 -2
- data/lib/generated_definitions/ie.rb +2 -2
- data/lib/generated_definitions/is.rb +2 -2
- data/lib/generated_definitions/it.rb +2 -2
- data/lib/generated_definitions/jp.rb +12 -6
- data/lib/generated_definitions/kr.rb +2 -2
- data/lib/generated_definitions/li.rb +2 -2
- data/lib/generated_definitions/lt.rb +2 -2
- data/lib/generated_definitions/lu.rb +2 -2
- data/lib/generated_definitions/ma.rb +2 -2
- data/lib/generated_definitions/mt_en.rb +2 -2
- data/lib/generated_definitions/mt_mt.rb +2 -2
- data/lib/generated_definitions/mx.rb +3 -3
- data/lib/generated_definitions/my.rb +2 -2
- data/lib/generated_definitions/nerc.rb +2 -2
- data/lib/generated_definitions/nl.rb +2 -2
- data/lib/generated_definitions/no.rb +2 -2
- data/lib/generated_definitions/{north_america.rb → northamerica.rb} +6 -5
- data/lib/generated_definitions/nyse.rb +2 -2
- data/lib/generated_definitions/nz.rb +2 -2
- data/lib/generated_definitions/pe.rb +2 -2
- data/lib/generated_definitions/ph.rb +2 -2
- data/lib/generated_definitions/pl.rb +2 -2
- data/lib/generated_definitions/pt.rb +2 -2
- data/lib/generated_definitions/ro.rb +2 -2
- data/lib/generated_definitions/rs_cyrl.rb +2 -2
- data/lib/generated_definitions/rs_la.rb +2 -2
- data/lib/generated_definitions/ru.rb +2 -2
- data/lib/generated_definitions/scandinavia.rb +2 -2
- data/lib/generated_definitions/se.rb +2 -2
- data/lib/generated_definitions/sg.rb +2 -2
- data/lib/generated_definitions/si.rb +2 -2
- data/lib/generated_definitions/sk.rb +2 -2
- data/lib/generated_definitions/{south_america.rb → southamerica.rb} +3 -3
- data/lib/generated_definitions/tn.rb +2 -2
- data/lib/generated_definitions/tr.rb +2 -2
- data/lib/generated_definitions/ua.rb +37 -0
- data/lib/generated_definitions/{united_nations.rb → unitednations.rb} +61 -61
- data/lib/generated_definitions/ups.rb +2 -2
- data/lib/generated_definitions/us.rb +3 -3
- data/lib/generated_definitions/ve.rb +2 -2
- data/lib/generated_definitions/vi.rb +2 -2
- data/lib/generated_definitions/za.rb +2 -2
- data/lib/holidays/definition/context/generator.rb +3 -36
- data/lib/holidays/definition/generator/module.rb +54 -0
- data/lib/holidays/definition/generator/regions.rb +1 -1
- data/lib/holidays/factory/definition.rb +7 -0
- data/lib/holidays/version.rb +1 -1
- data/test/defs/test_defs_ca.rb +18 -2
- data/test/defs/{test_defs_ecb_target.rb → test_defs_ecbtarget.rb} +11 -11
- data/test/defs/test_defs_europe.rb +31 -1
- data/test/defs/{test_defs_federal_reserve.rb → test_defs_federalreserve.rb} +54 -54
- data/test/defs/test_defs_federalreservebanks.rb +113 -0
- data/test/defs/test_defs_jp.rb +19 -1
- data/test/defs/test_defs_mx.rb +1 -1
- data/test/defs/{test_defs_north_america.rb → test_defs_northamerica.rb} +20 -4
- data/test/defs/{test_defs_south_america.rb → test_defs_southamerica.rb} +2 -2
- data/test/defs/test_defs_ua.rb +41 -0
- data/test/defs/{test_defs_united_nations.rb → test_defs_unitednations.rb} +3 -3
- data/test/defs/test_defs_us.rb +1 -1
- data/test/holidays/definition/context/test_generator.rb +13 -3
- data/test/holidays/definition/generator/test_module.rb +268 -0
- data/test/integration/test_available_regions.rb +1 -1
- data/test/integration/test_holidays.rb +1 -7
- data/test/integration/test_holidays_between.rb +1 -1
- data/test/integration/test_nonstandard_regions.rb +25 -0
- metadata +28 -17
@@ -12,7 +12,7 @@ module Holidays
|
|
12
12
|
|
13
13
|
def self.holidays_by_month
|
14
14
|
{
|
15
|
-
|
15
|
+
0 => [{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -49, :type => :informal, :name => "Fastelavn", :regions => [:dk]},
|
16
16
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -7, :type => :informal, :name => "Palmesøndag", :regions => [:dk]},
|
17
17
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -3, :name => "Skærtorsdag", :regions => [:dk]},
|
18
18
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -2, :name => "Langfredag", :regions => [:dk]},
|
@@ -115,7 +115,7 @@ module Holidays
|
|
115
115
|
|
116
116
|
def self.custom_methods
|
117
117
|
{
|
118
|
-
|
118
|
+
"is_sumardagurinn_fyrsti(year)" => Proc.new { |year|
|
119
119
|
date = Date.civil(year,4,18)
|
120
120
|
if date.wday < 4
|
121
121
|
date += (4 - date.wday)
|
@@ -12,7 +12,7 @@ module Holidays
|
|
12
12
|
|
13
13
|
def self.holidays_by_month
|
14
14
|
{
|
15
|
-
|
15
|
+
0 => [{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -2, :name => "Långfredagen", :regions => [:se]},
|
16
16
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -1, :type => :informal, :name => "Påskafton", :regions => [:se]},
|
17
17
|
{:function => "easter(year)", :function_arguments => [:year], :name => "Påskdagen", :regions => [:se]},
|
18
18
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 1, :name => "Annandag påsk", :regions => [:se]},
|
@@ -34,7 +34,7 @@ module Holidays
|
|
34
34
|
|
35
35
|
def self.custom_methods
|
36
36
|
{
|
37
|
-
|
37
|
+
"se_midsommardagen(year)" => Proc.new { |year|
|
38
38
|
date = Date.civil(year,6,20)
|
39
39
|
date += (6 - date.wday)
|
40
40
|
date
|
@@ -12,7 +12,7 @@ module Holidays
|
|
12
12
|
|
13
13
|
def self.holidays_by_month
|
14
14
|
{
|
15
|
-
|
15
|
+
0 => [{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -2, :name => "Good Friday", :regions => [:sg]}],
|
16
16
|
1 => [{:mday => 1, :observed => "to_weekday_if_weekend(date)", :observed_arguments => [:date], :name => "New Year's Day", :regions => [:sg]}],
|
17
17
|
2 => [{:mday => 14, :type => :informal, :name => "Valentine's Day", :regions => [:sg]},
|
18
18
|
{:mday => 15, :type => :informal, :name => "Total Defence Day", :regions => [:sg]}],
|
@@ -24,7 +24,7 @@ module Holidays
|
|
24
24
|
|
25
25
|
def self.custom_methods
|
26
26
|
{
|
27
|
-
|
27
|
+
|
28
28
|
}
|
29
29
|
end
|
30
30
|
end
|
@@ -12,7 +12,7 @@ module Holidays
|
|
12
12
|
|
13
13
|
def self.holidays_by_month
|
14
14
|
{
|
15
|
-
|
15
|
+
0 => [{:function => "easter(year)", :function_arguments => [:year], :name => "velikonočna nedelja", :regions => [:si]},
|
16
16
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 1, :name => "velikonočni ponedeljek", :regions => [:si]},
|
17
17
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 49, :name => "binkošti", :regions => [:si]}],
|
18
18
|
1 => [{:mday => 1, :name => "novo leto", :regions => [:si]}],
|
@@ -31,7 +31,7 @@ module Holidays
|
|
31
31
|
|
32
32
|
def self.custom_methods
|
33
33
|
{
|
34
|
-
|
34
|
+
|
35
35
|
}
|
36
36
|
end
|
37
37
|
end
|
@@ -12,7 +12,7 @@ module Holidays
|
|
12
12
|
|
13
13
|
def self.holidays_by_month
|
14
14
|
{
|
15
|
-
|
15
|
+
0 => [{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 1, :name => "Veľkonočný pondelok", :regions => [:sk]},
|
16
16
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -2, :name => "Veľký piatok", :regions => [:sk]}],
|
17
17
|
1 => [{:mday => 1, :name => "Nový rok", :regions => [:sk]},
|
18
18
|
{:mday => 6, :name => "Zjavenie Pána (Traja králi)", :regions => [:sk]}],
|
@@ -32,7 +32,7 @@ module Holidays
|
|
32
32
|
|
33
33
|
def self.custom_methods
|
34
34
|
{
|
35
|
-
|
35
|
+
|
36
36
|
}
|
37
37
|
end
|
38
38
|
end
|
@@ -5,14 +5,14 @@ module Holidays
|
|
5
5
|
# Definitions loaded: definitions/ar.yaml, definitions/br.yaml, definitions/cl.yaml, definitions/co.yaml, definitions/pe.yaml, definitions/ve.yaml
|
6
6
|
#
|
7
7
|
# All the definitions are available at https://github.com/holidays/holidays
|
8
|
-
module
|
8
|
+
module SOUTHAMERICA # :nodoc:
|
9
9
|
def self.defined_regions
|
10
10
|
[:ar, :br, :cl, :co, :pe, :ve]
|
11
11
|
end
|
12
12
|
|
13
13
|
def self.holidays_by_month
|
14
14
|
{
|
15
|
-
|
15
|
+
0 => [{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -2, :name => "Viernes Santo", :regions => [:ar]},
|
16
16
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -48, :name => "Carnaval Lunes", :regions => [:ar]},
|
17
17
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -47, :name => "Carnaval Martes", :regions => [:ar]},
|
18
18
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -47, :type => :informal, :name => "Carnaval", :regions => [:br]},
|
@@ -112,7 +112,7 @@ module Holidays
|
|
112
112
|
|
113
113
|
def self.custom_methods
|
114
114
|
{
|
115
|
-
|
115
|
+
"st_peter_st_paul_cl(year)" => Proc.new { |year|
|
116
116
|
date = Date.civil(year, 6, 29)
|
117
117
|
if [2,3,4].include?(date.wday)
|
118
118
|
date -= (date.wday - 1)
|
@@ -12,7 +12,7 @@ module Holidays
|
|
12
12
|
|
13
13
|
def self.holidays_by_month
|
14
14
|
{
|
15
|
-
|
15
|
+
1 => [{:mday => 1, :name => "Jour de l'an", :regions => [:tn]},
|
16
16
|
{:mday => 14, :name => "Fête de la Révolution et de la Jeunesse", :regions => [:tn]}],
|
17
17
|
3 => [{:mday => 20, :name => "Fête de l'Indépendance", :regions => [:tn]}],
|
18
18
|
4 => [{:mday => 9, :name => "Journée des Martyrs", :regions => [:tn]}],
|
@@ -25,7 +25,7 @@ module Holidays
|
|
25
25
|
|
26
26
|
def self.custom_methods
|
27
27
|
{
|
28
|
-
|
28
|
+
|
29
29
|
}
|
30
30
|
end
|
31
31
|
end
|
@@ -12,7 +12,7 @@ module Holidays
|
|
12
12
|
|
13
13
|
def self.holidays_by_month
|
14
14
|
{
|
15
|
-
|
15
|
+
0 => [{:function => "ramadan_feast(year)", :function_arguments => [:year], :name => "Ramazan Bayramı", :regions => [:tr]},
|
16
16
|
{:function => "ramadan_feast(year)", :function_arguments => [:year], :function_modifier => 1, :name => "Ramazan Bayramı (ikinci tatil)", :regions => [:tr]},
|
17
17
|
{:function => "ramadan_feast(year)", :function_arguments => [:year], :function_modifier => 2, :name => "Ramazan Bayramı (üçüncü tatil)", :regions => [:tr]},
|
18
18
|
{:function => "sacrifice_feast(year)", :function_arguments => [:year], :name => "Kurban Bayramı", :regions => [:tr]},
|
@@ -31,7 +31,7 @@ module Holidays
|
|
31
31
|
|
32
32
|
def self.custom_methods
|
33
33
|
{
|
34
|
-
|
34
|
+
"ramadan_feast(year)" => Proc.new { |year|
|
35
35
|
begin_of_ramadan_feast = {
|
36
36
|
'2014' => Date.civil(2014, 7, 28),
|
37
37
|
'2015' => Date.civil(2015, 7, 17),
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
module Holidays
|
3
|
+
# This file is generated by the Ruby Holidays gem.
|
4
|
+
#
|
5
|
+
# Definitions loaded: definitions/ua.yaml
|
6
|
+
#
|
7
|
+
# All the definitions are available at https://github.com/holidays/holidays
|
8
|
+
module UA # :nodoc:
|
9
|
+
def self.defined_regions
|
10
|
+
[:ua]
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.holidays_by_month
|
14
|
+
{
|
15
|
+
0 => [{:function => "orthodox_easter(year)", :function_arguments => [:year], :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Великдень", :regions => [:ua]},
|
16
|
+
{:function => "orthodox_easter(year)", :function_arguments => [:year], :function_modifier => 49, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Трійця", :regions => [:ua]}],
|
17
|
+
1 => [{:mday => 1, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Новий Рік", :regions => [:ua]},
|
18
|
+
{:mday => 7, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Різдво Христове", :regions => [:ua]}],
|
19
|
+
3 => [{:mday => 8, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Міжнародний жіночий день", :regions => [:ua]}],
|
20
|
+
5 => [{:mday => 1, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "День праці", :regions => [:ua]},
|
21
|
+
{:mday => 2, :year_ranges => [{:before => 2017}],:name => "День міжнародної солідарності трудящих", :regions => [:ua]},
|
22
|
+
{:mday => 9, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "День перемоги над нацизмом у Другій світовій війні", :regions => [:ua]}],
|
23
|
+
6 => [{:mday => 28, :year_ranges => [{:after => 1997}],:observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "День Конституції", :regions => [:ua]}],
|
24
|
+
7 => [{:mday => 16, :year_ranges => [{:limited => [1991]}],:name => "День Незалежності України", :regions => [:ua]}],
|
25
|
+
8 => [{:mday => 24, :year_ranges => [{:after => 1992}],:observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "День Незалежності", :regions => [:ua]}],
|
26
|
+
10 => [{:mday => 14, :year_ranges => [{:after => 2015}],:observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "День захисника України", :regions => [:ua]}],
|
27
|
+
12 => [{:mday => 25, :year_ranges => [{:after => 2017}],:observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Різдво Христове", :regions => [:ua]}]
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.custom_methods
|
32
|
+
{
|
33
|
+
|
34
|
+
}
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -2,79 +2,79 @@
|
|
2
2
|
module Holidays
|
3
3
|
# This file is generated by the Ruby Holidays gem.
|
4
4
|
#
|
5
|
-
# Definitions loaded: definitions/
|
5
|
+
# Definitions loaded: definitions/unitednations.yaml
|
6
6
|
#
|
7
7
|
# All the definitions are available at https://github.com/holidays/holidays
|
8
|
-
module
|
8
|
+
module UNITEDNATIONS # :nodoc:
|
9
9
|
def self.defined_regions
|
10
|
-
[:
|
10
|
+
[:unitednations]
|
11
11
|
end
|
12
12
|
|
13
13
|
def self.holidays_by_month
|
14
14
|
{
|
15
|
-
|
16
|
-
3 => [{:mday => 8, :name => "United Nations Day for Women's Rights and International Peace", :regions => [:
|
17
|
-
{:mday => 21, :name => "International Day for the Elimination of Racial Discrimination", :regions => [:
|
18
|
-
{:mday => 21, :name => "Beginning of the Week of Solidarity with the Peoples Struggling against Racism and Racial Discrimination", :regions => [:
|
19
|
-
{:mday => 22, :name => "World Day for Water", :regions => [:
|
20
|
-
{:mday => 23, :name => "World Meteorological Day", :regions => [:
|
21
|
-
4 => [{:mday => 7, :name => "World Health Day", :regions => [:
|
22
|
-
{:mday => 23, :name => "World Book and Copyright Day", :regions => [:
|
23
|
-
5 => [{:mday => 3, :name => "World Press Freedom Day", :regions => [:
|
24
|
-
{:mday => 15, :name => "International Day of Families", :regions => [:
|
25
|
-
{:mday => 17, :name => "World Telecommunication Day", :regions => [:
|
26
|
-
{:mday => 21, :name => "World Day for Cultural Diversity for Dialogue and Development", :regions => [:
|
27
|
-
{:mday => 22, :name => "International Day for Biological Diversity", :regions => [:
|
28
|
-
{:mday => 25, :name => "Beginning of the Week of Solidarity with the Peoples of Non-Self-Governing Territories", :regions => [:
|
29
|
-
{:mday => 29, :name => "International Day of United Nations Peacekeepers", :regions => [:
|
30
|
-
{:mday => 31, :name => "World No-Tobacco Day", :regions => [:
|
31
|
-
6 => [{:mday => 4, :name => "International Day of Innocent Children Victims of Aggression", :regions => [:
|
32
|
-
{:mday => 5, :name => "World Environment Day", :regions => [:
|
33
|
-
{:mday => 17, :name => "World Day to Combat Desertification and Drought", :regions => [:
|
34
|
-
{:mday => 20, :name => "World Refugee Day", :regions => [:
|
35
|
-
{:mday => 23, :name => "United Nations Public Service Day", :regions => [:
|
36
|
-
{:mday => 26, :name => "International Day against Drug Abuse and Illicit Trafficking", :regions => [:
|
37
|
-
{:mday => 26, :name => "International Day in Support of Victims of Torture", :regions => [:
|
38
|
-
7 => [{:wday => 6, :week => 1, :name => "International Day of Cooperatives", :regions => [:
|
39
|
-
{:mday => 11, :name => "World Population Day", :regions => [:
|
40
|
-
8 => [{:mday => 9, :name => "International Day of the World's Indigenous People", :regions => [:
|
41
|
-
{:mday => 12, :name => "International Youth Day", :regions => [:
|
42
|
-
{:mday => 23, :name => "International Day for the Remembrance of the Slave Trade and Its Abolition", :regions => [:
|
43
|
-
9 => [{:mday => 8, :name => "International Literacy Day", :regions => [:
|
44
|
-
{:mday => 16, :name => "International Day for the Preservation of the Ozone Layer", :regions => [:
|
45
|
-
{:mday => 21, :name => "International Day of Peace", :regions => [:
|
46
|
-
{:mday => 1, :name => "International Day of Older Persons", :regions => [:
|
47
|
-
10 => [{:mday => 4, :name => "World Space Week", :regions => [:
|
48
|
-
{:mday => 5, :name => "World Teachers' Day", :regions => [:
|
49
|
-
{:wday => 1, :week => 1, :name => "World Habitat Day", :regions => [:
|
50
|
-
{:wday => 3, :week => 2, :name => "International Day for Natural Disaster Reduction", :regions => [:
|
51
|
-
{:mday => 9, :name => "World Post Day", :regions => [:
|
52
|
-
{:mday => 10, :name => "World Mental Health Day", :regions => [:
|
53
|
-
{:mday => 16, :name => "World Food Day", :regions => [:
|
54
|
-
{:mday => 17, :name => "International Day for the Eradication of Poverty", :regions => [:
|
55
|
-
{:mday => 24, :name => "United Nations Day", :regions => [:
|
56
|
-
{:mday => 24, :name => "World Development Information Day", :regions => [:
|
57
|
-
{:mday => 24, :name => "Disarmament Week", :regions => [:
|
58
|
-
11 => [{:mday => 6, :name => "International Day for Preventing the Exploitation of the Environment in War and Armed Conflict", :regions => [:
|
59
|
-
{:mday => 16, :name => "International Day for Tolerance", :regions => [:
|
60
|
-
{:mday => 20, :name => "Africa Industrialization Day", :regions => [:
|
61
|
-
{:mday => 20, :name => "Universal Children's Day", :regions => [:
|
62
|
-
{:mday => 21, :name => "World Television Day", :regions => [:
|
63
|
-
{:mday => 25, :name => "International Day for the Elimination of Violence against Women", :regions => [:
|
64
|
-
{:mday => 29, :name => "International Day of Solidarity with the Palestinian People", :regions => [:
|
65
|
-
12 => [{:mday => 1, :name => "World AIDS Day", :regions => [:
|
66
|
-
{:mday => 2, :name => "International Day for the Abolition of Slavery", :regions => [:
|
67
|
-
{:mday => 3, :name => "International Day of Disabled Persons", :regions => [:
|
68
|
-
{:mday => 5, :name => "International Volunteer Day for Economic and Social Development", :regions => [:
|
69
|
-
{:mday => 7, :name => "International Civil Aviation Day", :regions => [:
|
70
|
-
{:mday => 10, :name => "Human Rights Day", :regions => [:
|
71
|
-
{:mday => 18, :name => "International Migrants Day", :regions => [:
|
15
|
+
2 => [{:mday => 2, :name => "International Mother Language Day", :regions => [:unitednations]}],
|
16
|
+
3 => [{:mday => 8, :name => "United Nations Day for Women's Rights and International Peace", :regions => [:unitednations]},
|
17
|
+
{:mday => 21, :name => "International Day for the Elimination of Racial Discrimination", :regions => [:unitednations]},
|
18
|
+
{:mday => 21, :name => "Beginning of the Week of Solidarity with the Peoples Struggling against Racism and Racial Discrimination", :regions => [:unitednations]},
|
19
|
+
{:mday => 22, :name => "World Day for Water", :regions => [:unitednations]},
|
20
|
+
{:mday => 23, :name => "World Meteorological Day", :regions => [:unitednations]}],
|
21
|
+
4 => [{:mday => 7, :name => "World Health Day", :regions => [:unitednations]},
|
22
|
+
{:mday => 23, :name => "World Book and Copyright Day", :regions => [:unitednations]}],
|
23
|
+
5 => [{:mday => 3, :name => "World Press Freedom Day", :regions => [:unitednations]},
|
24
|
+
{:mday => 15, :name => "International Day of Families", :regions => [:unitednations]},
|
25
|
+
{:mday => 17, :name => "World Telecommunication Day", :regions => [:unitednations]},
|
26
|
+
{:mday => 21, :name => "World Day for Cultural Diversity for Dialogue and Development", :regions => [:unitednations]},
|
27
|
+
{:mday => 22, :name => "International Day for Biological Diversity", :regions => [:unitednations]},
|
28
|
+
{:mday => 25, :name => "Beginning of the Week of Solidarity with the Peoples of Non-Self-Governing Territories", :regions => [:unitednations]},
|
29
|
+
{:mday => 29, :name => "International Day of United Nations Peacekeepers", :regions => [:unitednations]},
|
30
|
+
{:mday => 31, :name => "World No-Tobacco Day", :regions => [:unitednations]}],
|
31
|
+
6 => [{:mday => 4, :name => "International Day of Innocent Children Victims of Aggression", :regions => [:unitednations]},
|
32
|
+
{:mday => 5, :name => "World Environment Day", :regions => [:unitednations]},
|
33
|
+
{:mday => 17, :name => "World Day to Combat Desertification and Drought", :regions => [:unitednations]},
|
34
|
+
{:mday => 20, :name => "World Refugee Day", :regions => [:unitednations]},
|
35
|
+
{:mday => 23, :name => "United Nations Public Service Day", :regions => [:unitednations]},
|
36
|
+
{:mday => 26, :name => "International Day against Drug Abuse and Illicit Trafficking", :regions => [:unitednations]},
|
37
|
+
{:mday => 26, :name => "International Day in Support of Victims of Torture", :regions => [:unitednations]}],
|
38
|
+
7 => [{:wday => 6, :week => 1, :name => "International Day of Cooperatives", :regions => [:unitednations]},
|
39
|
+
{:mday => 11, :name => "World Population Day", :regions => [:unitednations]}],
|
40
|
+
8 => [{:mday => 9, :name => "International Day of the World's Indigenous People", :regions => [:unitednations]},
|
41
|
+
{:mday => 12, :name => "International Youth Day", :regions => [:unitednations]},
|
42
|
+
{:mday => 23, :name => "International Day for the Remembrance of the Slave Trade and Its Abolition", :regions => [:unitednations]}],
|
43
|
+
9 => [{:mday => 8, :name => "International Literacy Day", :regions => [:unitednations]},
|
44
|
+
{:mday => 16, :name => "International Day for the Preservation of the Ozone Layer", :regions => [:unitednations]},
|
45
|
+
{:mday => 21, :name => "International Day of Peace", :regions => [:unitednations]},
|
46
|
+
{:mday => 1, :name => "International Day of Older Persons", :regions => [:unitednations]}],
|
47
|
+
10 => [{:mday => 4, :name => "World Space Week", :regions => [:unitednations]},
|
48
|
+
{:mday => 5, :name => "World Teachers' Day", :regions => [:unitednations]},
|
49
|
+
{:wday => 1, :week => 1, :name => "World Habitat Day", :regions => [:unitednations]},
|
50
|
+
{:wday => 3, :week => 2, :name => "International Day for Natural Disaster Reduction", :regions => [:unitednations]},
|
51
|
+
{:mday => 9, :name => "World Post Day", :regions => [:unitednations]},
|
52
|
+
{:mday => 10, :name => "World Mental Health Day", :regions => [:unitednations]},
|
53
|
+
{:mday => 16, :name => "World Food Day", :regions => [:unitednations]},
|
54
|
+
{:mday => 17, :name => "International Day for the Eradication of Poverty", :regions => [:unitednations]},
|
55
|
+
{:mday => 24, :name => "United Nations Day", :regions => [:unitednations]},
|
56
|
+
{:mday => 24, :name => "World Development Information Day", :regions => [:unitednations]},
|
57
|
+
{:mday => 24, :name => "Disarmament Week", :regions => [:unitednations]}],
|
58
|
+
11 => [{:mday => 6, :name => "International Day for Preventing the Exploitation of the Environment in War and Armed Conflict", :regions => [:unitednations]},
|
59
|
+
{:mday => 16, :name => "International Day for Tolerance", :regions => [:unitednations]},
|
60
|
+
{:mday => 20, :name => "Africa Industrialization Day", :regions => [:unitednations]},
|
61
|
+
{:mday => 20, :name => "Universal Children's Day", :regions => [:unitednations]},
|
62
|
+
{:mday => 21, :name => "World Television Day", :regions => [:unitednations]},
|
63
|
+
{:mday => 25, :name => "International Day for the Elimination of Violence against Women", :regions => [:unitednations]},
|
64
|
+
{:mday => 29, :name => "International Day of Solidarity with the Palestinian People", :regions => [:unitednations]}],
|
65
|
+
12 => [{:mday => 1, :name => "World AIDS Day", :regions => [:unitednations]},
|
66
|
+
{:mday => 2, :name => "International Day for the Abolition of Slavery", :regions => [:unitednations]},
|
67
|
+
{:mday => 3, :name => "International Day of Disabled Persons", :regions => [:unitednations]},
|
68
|
+
{:mday => 5, :name => "International Volunteer Day for Economic and Social Development", :regions => [:unitednations]},
|
69
|
+
{:mday => 7, :name => "International Civil Aviation Day", :regions => [:unitednations]},
|
70
|
+
{:mday => 10, :name => "Human Rights Day", :regions => [:unitednations]},
|
71
|
+
{:mday => 18, :name => "International Migrants Day", :regions => [:unitednations]}]
|
72
72
|
}
|
73
73
|
end
|
74
74
|
|
75
75
|
def self.custom_methods
|
76
76
|
{
|
77
|
-
|
77
|
+
|
78
78
|
}
|
79
79
|
end
|
80
80
|
end
|
@@ -12,7 +12,7 @@ module Holidays
|
|
12
12
|
|
13
13
|
def self.holidays_by_month
|
14
14
|
{
|
15
|
-
|
15
|
+
1 => [{:mday => 1, :observed => "to_weekday_if_weekend(date)", :observed_arguments => [:date], :name => "New Year's Day", :regions => [:ups]}],
|
16
16
|
5 => [{:wday => 1, :week => -1, :name => "Memorial Day", :regions => [:ups]}],
|
17
17
|
7 => [{:mday => 4, :observed => "to_weekday_if_weekend(date)", :observed_arguments => [:date], :name => "Independence Day", :regions => [:ups]}],
|
18
18
|
9 => [{:wday => 1, :week => 1, :name => "Labor Day", :regions => [:ups]}],
|
@@ -25,7 +25,7 @@ module Holidays
|
|
25
25
|
|
26
26
|
def self.custom_methods
|
27
27
|
{
|
28
|
-
|
28
|
+
"day_after_thanksgiving(year)" => Proc.new { |year|
|
29
29
|
Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 11, 4, 4) + 1
|
30
30
|
},
|
31
31
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
module Holidays
|
3
3
|
# This file is generated by the Ruby Holidays gem.
|
4
4
|
#
|
5
|
-
# Definitions loaded: definitions/us.yaml, definitions/
|
5
|
+
# Definitions loaded: definitions/us.yaml, definitions/northamericainformal.yaml
|
6
6
|
#
|
7
7
|
# All the definitions are available at https://github.com/holidays/holidays
|
8
8
|
module US # :nodoc:
|
@@ -12,7 +12,7 @@ module Holidays
|
|
12
12
|
|
13
13
|
def self.holidays_by_month
|
14
14
|
{
|
15
|
-
|
15
|
+
0 => [{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -47, :name => "Shrove Tuesday", :regions => [:us_fl]},
|
16
16
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -47, :name => "Mardi Gras Day", :regions => [:us_la]},
|
17
17
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -2, :type => :informal, :name => "Good Friday", :regions => [:us]},
|
18
18
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -2, :name => "Good Friday", :regions => [:us_ct, :us_de, :us_gu, :us_hi, :us_in, :us_ky, :us_la, :us_nj, :us_nc, :us_nd, :us_pr, :us_tn]},
|
@@ -90,7 +90,7 @@ module Holidays
|
|
90
90
|
|
91
91
|
def self.custom_methods
|
92
92
|
{
|
93
|
-
|
93
|
+
"christmas_eve_holiday(date)" => Proc.new { |date|
|
94
94
|
beginning_of_month = Date.civil(date.year, date.month, 1)
|
95
95
|
(date.saturday? || date.sunday?) ? date.downto(beginning_of_month).find {|d| d if d.wday == 5} : date
|
96
96
|
},
|
@@ -12,7 +12,7 @@ module Holidays
|
|
12
12
|
|
13
13
|
def self.holidays_by_month
|
14
14
|
{
|
15
|
-
|
15
|
+
0 => [{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -48, :name => "Lunes Carnaval", :regions => [:ve]},
|
16
16
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -47, :name => "Martes Carnaval", :regions => [:ve]},
|
17
17
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -3, :name => "Jueves Santo", :regions => [:ve]},
|
18
18
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -2, :name => "Viernes Santo", :regions => [:ve]}],
|
@@ -29,7 +29,7 @@ module Holidays
|
|
29
29
|
|
30
30
|
def self.custom_methods
|
31
31
|
{
|
32
|
-
|
32
|
+
|
33
33
|
}
|
34
34
|
end
|
35
35
|
end
|
@@ -12,7 +12,7 @@ module Holidays
|
|
12
12
|
|
13
13
|
def self.holidays_by_month
|
14
14
|
{
|
15
|
-
|
15
|
+
1 => [{:mday => 1, :name => "Tết dương lịch", :regions => [:vi]}],
|
16
16
|
3 => [{:mday => 10, :function => "lunar_to_solar(year, month, day, region)", :function_arguments => [:year, :month, :day, :region], :name => "Giỗ tổ Hùng Vương", :regions => [:vi]}],
|
17
17
|
4 => [{:mday => 30, :name => "Ngày Giải phóng miền Nam, thống nhất đất nước", :regions => [:vi]}],
|
18
18
|
5 => [{:mday => 1, :name => "Ngày Quốc tế Lao động", :regions => [:vi]}],
|
@@ -22,7 +22,7 @@ module Holidays
|
|
22
22
|
|
23
23
|
def self.custom_methods
|
24
24
|
{
|
25
|
-
|
25
|
+
|
26
26
|
}
|
27
27
|
end
|
28
28
|
end
|
@@ -12,7 +12,7 @@ module Holidays
|
|
12
12
|
|
13
13
|
def self.holidays_by_month
|
14
14
|
{
|
15
|
-
|
15
|
+
0 => [{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -2, :name => "Good Friday", :regions => [:za]},
|
16
16
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 1, :name => "Family Day", :regions => [:za]}],
|
17
17
|
1 => [{:mday => 1, :observed => "to_monday_if_sunday(date)", :observed_arguments => [:date], :name => "New Year's Day", :regions => [:za]}],
|
18
18
|
3 => [{:mday => 21, :observed => "to_monday_if_sunday(date)", :observed_arguments => [:date], :name => "Human Rights Day", :regions => [:za]}],
|
@@ -29,7 +29,7 @@ module Holidays
|
|
29
29
|
|
30
30
|
def self.custom_methods
|
31
31
|
{
|
32
|
-
|
32
|
+
|
33
33
|
}
|
34
34
|
end
|
35
35
|
end
|
@@ -11,12 +11,13 @@ module Holidays
|
|
11
11
|
module Definition
|
12
12
|
module Context
|
13
13
|
class Generator
|
14
|
-
def initialize(custom_method_parser, custom_method_source_decorator, custom_methods_repository, test_parser, test_source_generator)
|
14
|
+
def initialize(custom_method_parser, custom_method_source_decorator, custom_methods_repository, test_parser, test_source_generator, module_source_generator)
|
15
15
|
@custom_method_parser = custom_method_parser
|
16
16
|
@custom_method_source_decorator = custom_method_source_decorator
|
17
17
|
@custom_methods_repository = custom_methods_repository
|
18
18
|
@test_parser = test_parser
|
19
19
|
@test_source_generator = test_source_generator
|
20
|
+
@module_source_generator = module_source_generator
|
20
21
|
end
|
21
22
|
|
22
23
|
def parse_definition_files(files)
|
@@ -66,7 +67,7 @@ module Holidays
|
|
66
67
|
custom_method_string << @custom_method_source_decorator.call(code) + ",\n\n"
|
67
68
|
end
|
68
69
|
|
69
|
-
module_src =
|
70
|
+
module_src = @module_source_generator.call(module_name, files, regions, month_strings, custom_method_string)
|
70
71
|
test_src = @test_source_generator.call(module_name, files, tests)
|
71
72
|
|
72
73
|
return module_src, test_src || ''
|
@@ -216,40 +217,6 @@ module Holidays
|
|
216
217
|
method.arguments.collect { |arg| arg.to_sym }
|
217
218
|
end
|
218
219
|
end
|
219
|
-
|
220
|
-
def generate_module_src(module_name, files, regions, month_strings, custom_methods)
|
221
|
-
module_src = ""
|
222
|
-
|
223
|
-
module_src =<<-EOM
|
224
|
-
# encoding: utf-8
|
225
|
-
module Holidays
|
226
|
-
# This file is generated by the Ruby Holidays gem.
|
227
|
-
#
|
228
|
-
# Definitions loaded: #{files.join(', ')}
|
229
|
-
#
|
230
|
-
# All the definitions are available at https://github.com/holidays/holidays
|
231
|
-
module #{module_name.to_s.upcase} # :nodoc:
|
232
|
-
def self.defined_regions
|
233
|
-
[:#{regions.join(', :')}]
|
234
|
-
end
|
235
|
-
|
236
|
-
def self.holidays_by_month
|
237
|
-
{
|
238
|
-
#{month_strings.join(",\n")}
|
239
|
-
}
|
240
|
-
end
|
241
|
-
|
242
|
-
def self.custom_methods
|
243
|
-
{
|
244
|
-
#{custom_methods}
|
245
|
-
}
|
246
|
-
end
|
247
|
-
end
|
248
|
-
end
|
249
|
-
EOM
|
250
|
-
|
251
|
-
return module_src
|
252
|
-
end
|
253
220
|
end
|
254
221
|
end
|
255
222
|
end
|