holidays 0.9.3 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. data/.gitignore +3 -0
  2. data/CHANGELOG +7 -0
  3. data/{README → README.rdoc} +36 -39
  4. data/data/SYNTAX +1 -1
  5. data/data/au.yaml +110 -105
  6. data/data/build_defs.rb +4 -3
  7. data/data/ca.yaml +140 -140
  8. data/data/cz.yaml +68 -0
  9. data/data/de.yaml +12 -14
  10. data/data/dk.yaml +1 -1
  11. data/data/es.yaml +1 -1
  12. data/data/fr.yaml +1 -1
  13. data/data/gb.yaml +1 -1
  14. data/data/ie.yaml +1 -1
  15. data/data/index.yaml +7 -2
  16. data/data/is.yaml +1 -1
  17. data/data/it.yaml +1 -1
  18. data/data/mx.yaml +1 -1
  19. data/data/nl.yaml +1 -1
  20. data/data/no.yaml +82 -0
  21. data/data/nyse.yaml +1 -1
  22. data/data/nz.yaml +141 -0
  23. data/data/pt.yaml +1 -1
  24. data/data/se.yaml +1 -1
  25. data/data/united_nations.yaml +188 -188
  26. data/data/ups.yaml +55 -55
  27. data/data/us.yaml +80 -80
  28. data/data/za.yaml +1 -1
  29. data/holidays.gemspec +155 -0
  30. data/lib/holidays.rb +424 -403
  31. data/lib/holidays/MANIFEST +28 -25
  32. data/lib/holidays/au.rb +43 -41
  33. data/lib/holidays/ca.rb +69 -68
  34. data/lib/holidays/cz.rb +36 -0
  35. data/lib/holidays/de.rb +51 -52
  36. data/lib/holidays/dk.rb +48 -47
  37. data/lib/holidays/es.rb +53 -52
  38. data/lib/holidays/europe.rb +236 -215
  39. data/lib/holidays/fr.rb +37 -36
  40. data/lib/holidays/gb.rb +41 -40
  41. data/lib/holidays/ie.rb +33 -32
  42. data/lib/holidays/is.rb +62 -61
  43. data/lib/holidays/it.rb +36 -35
  44. data/lib/holidays/mx.rb +52 -51
  45. data/lib/holidays/nl.rb +37 -36
  46. data/lib/holidays/no.rb +40 -0
  47. data/lib/holidays/north_america.rb +108 -107
  48. data/lib/holidays/nyse.rb +33 -32
  49. data/lib/holidays/nz.rb +69 -0
  50. data/lib/holidays/pt.rb +38 -52
  51. data/lib/holidays/scandinavia.rb +124 -114
  52. data/lib/holidays/se.rb +53 -52
  53. data/lib/holidays/united_nations.rb +25 -24
  54. data/lib/holidays/ups.rb +32 -31
  55. data/lib/holidays/us.rb +49 -48
  56. data/lib/holidays/za.rb +36 -35
  57. data/rakefile.rb +105 -113
  58. data/test/defs/test_defs_au.rb +36 -36
  59. data/test/defs/test_defs_ca.rb +29 -29
  60. data/test/defs/test_defs_cz.rb +26 -0
  61. data/test/defs/test_defs_de.rb +51 -46
  62. data/test/defs/test_defs_dk.rb +30 -30
  63. data/test/defs/test_defs_es.rb +57 -57
  64. data/test/defs/test_defs_europe.rb +280 -240
  65. data/test/defs/test_defs_fr.rb +26 -26
  66. data/test/defs/test_defs_gb.rb +36 -36
  67. data/test/defs/test_defs_ie.rb +21 -21
  68. data/test/defs/test_defs_is.rb +33 -33
  69. data/test/defs/test_defs_it.rb +25 -25
  70. data/test/defs/test_defs_mx.rb +22 -22
  71. data/test/defs/test_defs_nl.rb +24 -24
  72. data/test/defs/test_defs_no.rb +29 -0
  73. data/test/defs/test_defs_north_america.rb +54 -54
  74. data/test/defs/test_defs_nyse.rb +22 -22
  75. data/test/defs/test_defs_nz.rb +22 -0
  76. data/test/defs/test_defs_pt.rb +32 -32
  77. data/test/defs/test_defs_scandinavia.rb +94 -75
  78. data/test/defs/test_defs_se.rb +32 -32
  79. data/test/defs/test_defs_ups.rb +21 -21
  80. data/test/defs/test_defs_us.rb +23 -23
  81. data/test/defs/test_defs_za.rb +25 -25
  82. data/test/test_date.rb +123 -0
  83. data/test/test_helper.rb +22 -0
  84. data/test/test_holidays.rb +128 -0
  85. data/test/test_multiple_regions.rb +24 -0
  86. metadata +126 -73
@@ -81,5 +81,5 @@ tests: |
81
81
  Date.civil(2008,12,1) => 'Restauração da Independência',
82
82
  Date.civil(2008,12,8) => 'Imaculada Conceição',
83
83
  Date.civil(2008,12,25) => 'Natal'}.each do |date, name|
84
- assert_equal name, Holidays.on(date, :pt, :informal)[0][:name]
84
+ assert_equal name, (Holidays.on(date, :pt, :informal)[0] || {})[:name]
85
85
  end
@@ -87,5 +87,5 @@ tests: |
87
87
  Date.civil(2008,11,1) => 'Alla helgons dag',
88
88
  Date.civil(2008,12,25) => 'Juldagen',
89
89
  Date.civil(2008,12,26) => 'Annandag jul'}.each do |date, name|
90
- assert_equal name, Holidays.on(date, :se, :informal)[0][:name]
90
+ assert_equal name, (Holidays.on(date, :se, :informal)[0] || {})[:name]
91
91
  end
@@ -1,188 +1,188 @@
1
- # United Nationas holiday definitions for the Ruby Holiday gem.
2
- # Updated 2008-11-21.
3
- ---
4
- 2:
5
- - name: International Mother Language Day
6
- regions: [un]
7
- mday: 2
8
- 3:
9
- - name: United Nations Day for Women's Rights and International Peace
10
- regions: [un]
11
- mday: 8
12
- - name: International Day for the Elimination of Racial Discrimination
13
- regions: [un]
14
- mday: 21
15
- - name: Beginning of the Week of Solidarity with the Peoples Struggling against Racism and Racial Discrimination
16
- regions: [un]
17
- mday: 21
18
- - name: World Day for Water
19
- regions: [un]
20
- mday: 22
21
- - name: World Meteorological Day
22
- regions: [un]
23
- mday: 23
24
- 4:
25
- - name: World Health Day
26
- regions: [un]
27
- mday: 7
28
- - name: World Book and Copyright Day
29
- regions: [un]
30
- mday: 23
31
- 5:
32
- - name: World Press Freedom Day
33
- regions: [un]
34
- mday: 3
35
- - name: International Day of Families
36
- regions: [un]
37
- mday: 15
38
- - name: World Telecommunication Day
39
- regions: [un]
40
- mday: 17
41
- - name: World Day for Cultural Diversity for Dialogue and Development
42
- regions: [un]
43
- mday: 21
44
- - name: International Day for Biological Diversity
45
- regions: [un]
46
- mday: 22
47
- - name: Beginning of the Week of Solidarity with the Peoples of Non-Self-Governing Territories
48
- regions: [un]
49
- mday: 25
50
- - name: International Day of United Nations Peacekeepers
51
- regions: [un]
52
- mday: 29
53
- - name: World No-Tobacco Day
54
- regions: [un]
55
- mday: 31
56
- 6:
57
- - name: International Day of Innocent Children Victims of Aggression
58
- regions: [un]
59
- mday: 4
60
- - name: World Environment Day
61
- regions: [un]
62
- mday: 5
63
- - name: World Day to Combat Desertification and Drought
64
- regions: [un]
65
- mday: 17
66
- - name: World Refugee Day
67
- regions: [un]
68
- mday: 20
69
- - name: United Nations Public Service Day
70
- regions: [un]
71
- mday: 23
72
- - name: International Day against Drug Abuse and Illicit Trafficking
73
- regions: [un]
74
- mday: 26
75
- - name: International Day in Support of Victims of Torture
76
- regions: [un]
77
- mday: 26
78
- 7:
79
- - name: International Day of Cooperatives
80
- week: 1
81
- regions: [un]
82
- wday: 6
83
- - name: World Population Day
84
- regions: [un]
85
- mday: 11
86
- 8:
87
- - name: International Day of the World's Indigenous People
88
- regions: [un]
89
- mday: 9
90
- - name: International Youth Day
91
- regions: [un]
92
- mday: 12
93
- - name: International Day for the Remembrance of the Slave Trade and Its Abolition
94
- regions: [un]
95
- mday: 23
96
- 9:
97
- - name: International Literacy Day
98
- regions: [un]
99
- mday: 8
100
- - name: International Day for the Preservation of the Ozone Layer
101
- regions: [un]
102
- mday: 16
103
- - name: International Day of Peace
104
- regions: [un]
105
- mday: 21
106
- - name: International Day of Older Persons
107
- regions: [un]
108
- mday: 1
109
- 10:
110
- - name: World Space Week
111
- regions: [un]
112
- mday: 4
113
- - name: World Teachers' Day
114
- regions: [un]
115
- mday: 5
116
- - name: World Habitat Day
117
- week: 1
118
- regions: [un]
119
- wday: 1
120
- - name: International Day for Natural Disaster Reduction
121
- week: 2
122
- regions: [un]
123
- wday: 3
124
- - name: World Post Day
125
- regions: [un]
126
- mday: 9
127
- - name: World Mental Health Day
128
- regions: [un]
129
- mday: 10
130
- - name: World Food Day
131
- regions: [un]
132
- mday: 16
133
- - name: International Day for the Eradication of Poverty
134
- regions: [un]
135
- mday: 17
136
- - name: United Nations Day
137
- regions: [un]
138
- mday: 24
139
- - name: World Development Information Day
140
- regions: [un]
141
- mday: 24
142
- - name: Disarmament Week
143
- regions: [un]
144
- mday: 24
145
- 11:
146
- - name: International Day for Preventing the Exploitation of the Environment in War and Armed Conflict
147
- regions: [un]
148
- mday: 6
149
- - name: International Day for Tolerance
150
- regions: [un]
151
- mday: 16
152
- - name: Africa Industrialization Day
153
- regions: [un]
154
- mday: 20
155
- - name: Universal Children's Day
156
- regions: [un]
157
- mday: 20
158
- - name: World Television Day
159
- regions: [un]
160
- mday: 21
161
- - name: International Day for the Elimination of Violence against Women
162
- regions: [un]
163
- mday: 25
164
- - name: International Day of Solidarity with the Palestinian People
165
- regions: [un]
166
- mday: 29
167
- 12:
168
- - name: World AIDS Day
169
- regions: [un]
170
- mday: 1
171
- - name: International Day for the Abolition of Slavery
172
- regions: [un]
173
- mday: 2
174
- - name: International Day of Disabled Persons
175
- regions: [un]
176
- mday: 3
177
- - name: International Volunteer Day for Economic and Social Development
178
- regions: [un]
179
- mday: 5
180
- - name: International Civil Aviation Day
181
- regions: [un]
182
- mday: 7
183
- - name: Human Rights Day
184
- regions: [un]
185
- mday: 10
186
- - name: International Migrants Day
187
- regions: [un]
188
- mday: 18
1
+ # United Nationas holiday definitions for the Ruby Holiday gem.
2
+ # Updated 2008-11-21.
3
+ ---
4
+ 2:
5
+ - name: International Mother Language Day
6
+ regions: [un]
7
+ mday: 2
8
+ 3:
9
+ - name: United Nations Day for Women's Rights and International Peace
10
+ regions: [un]
11
+ mday: 8
12
+ - name: International Day for the Elimination of Racial Discrimination
13
+ regions: [un]
14
+ mday: 21
15
+ - name: Beginning of the Week of Solidarity with the Peoples Struggling against Racism and Racial Discrimination
16
+ regions: [un]
17
+ mday: 21
18
+ - name: World Day for Water
19
+ regions: [un]
20
+ mday: 22
21
+ - name: World Meteorological Day
22
+ regions: [un]
23
+ mday: 23
24
+ 4:
25
+ - name: World Health Day
26
+ regions: [un]
27
+ mday: 7
28
+ - name: World Book and Copyright Day
29
+ regions: [un]
30
+ mday: 23
31
+ 5:
32
+ - name: World Press Freedom Day
33
+ regions: [un]
34
+ mday: 3
35
+ - name: International Day of Families
36
+ regions: [un]
37
+ mday: 15
38
+ - name: World Telecommunication Day
39
+ regions: [un]
40
+ mday: 17
41
+ - name: World Day for Cultural Diversity for Dialogue and Development
42
+ regions: [un]
43
+ mday: 21
44
+ - name: International Day for Biological Diversity
45
+ regions: [un]
46
+ mday: 22
47
+ - name: Beginning of the Week of Solidarity with the Peoples of Non-Self-Governing Territories
48
+ regions: [un]
49
+ mday: 25
50
+ - name: International Day of United Nations Peacekeepers
51
+ regions: [un]
52
+ mday: 29
53
+ - name: World No-Tobacco Day
54
+ regions: [un]
55
+ mday: 31
56
+ 6:
57
+ - name: International Day of Innocent Children Victims of Aggression
58
+ regions: [un]
59
+ mday: 4
60
+ - name: World Environment Day
61
+ regions: [un]
62
+ mday: 5
63
+ - name: World Day to Combat Desertification and Drought
64
+ regions: [un]
65
+ mday: 17
66
+ - name: World Refugee Day
67
+ regions: [un]
68
+ mday: 20
69
+ - name: United Nations Public Service Day
70
+ regions: [un]
71
+ mday: 23
72
+ - name: International Day against Drug Abuse and Illicit Trafficking
73
+ regions: [un]
74
+ mday: 26
75
+ - name: International Day in Support of Victims of Torture
76
+ regions: [un]
77
+ mday: 26
78
+ 7:
79
+ - name: International Day of Cooperatives
80
+ week: 1
81
+ regions: [un]
82
+ wday: 6
83
+ - name: World Population Day
84
+ regions: [un]
85
+ mday: 11
86
+ 8:
87
+ - name: International Day of the World's Indigenous People
88
+ regions: [un]
89
+ mday: 9
90
+ - name: International Youth Day
91
+ regions: [un]
92
+ mday: 12
93
+ - name: International Day for the Remembrance of the Slave Trade and Its Abolition
94
+ regions: [un]
95
+ mday: 23
96
+ 9:
97
+ - name: International Literacy Day
98
+ regions: [un]
99
+ mday: 8
100
+ - name: International Day for the Preservation of the Ozone Layer
101
+ regions: [un]
102
+ mday: 16
103
+ - name: International Day of Peace
104
+ regions: [un]
105
+ mday: 21
106
+ - name: International Day of Older Persons
107
+ regions: [un]
108
+ mday: 1
109
+ 10:
110
+ - name: World Space Week
111
+ regions: [un]
112
+ mday: 4
113
+ - name: World Teachers' Day
114
+ regions: [un]
115
+ mday: 5
116
+ - name: World Habitat Day
117
+ week: 1
118
+ regions: [un]
119
+ wday: 1
120
+ - name: International Day for Natural Disaster Reduction
121
+ week: 2
122
+ regions: [un]
123
+ wday: 3
124
+ - name: World Post Day
125
+ regions: [un]
126
+ mday: 9
127
+ - name: World Mental Health Day
128
+ regions: [un]
129
+ mday: 10
130
+ - name: World Food Day
131
+ regions: [un]
132
+ mday: 16
133
+ - name: International Day for the Eradication of Poverty
134
+ regions: [un]
135
+ mday: 17
136
+ - name: United Nations Day
137
+ regions: [un]
138
+ mday: 24
139
+ - name: World Development Information Day
140
+ regions: [un]
141
+ mday: 24
142
+ - name: Disarmament Week
143
+ regions: [un]
144
+ mday: 24
145
+ 11:
146
+ - name: International Day for Preventing the Exploitation of the Environment in War and Armed Conflict
147
+ regions: [un]
148
+ mday: 6
149
+ - name: International Day for Tolerance
150
+ regions: [un]
151
+ mday: 16
152
+ - name: Africa Industrialization Day
153
+ regions: [un]
154
+ mday: 20
155
+ - name: Universal Children's Day
156
+ regions: [un]
157
+ mday: 20
158
+ - name: World Television Day
159
+ regions: [un]
160
+ mday: 21
161
+ - name: International Day for the Elimination of Violence against Women
162
+ regions: [un]
163
+ mday: 25
164
+ - name: International Day of Solidarity with the Palestinian People
165
+ regions: [un]
166
+ mday: 29
167
+ 12:
168
+ - name: World AIDS Day
169
+ regions: [un]
170
+ mday: 1
171
+ - name: International Day for the Abolition of Slavery
172
+ regions: [un]
173
+ mday: 2
174
+ - name: International Day of Disabled Persons
175
+ regions: [un]
176
+ mday: 3
177
+ - name: International Volunteer Day for Economic and Social Development
178
+ regions: [un]
179
+ mday: 5
180
+ - name: International Civil Aviation Day
181
+ regions: [un]
182
+ mday: 7
183
+ - name: Human Rights Day
184
+ regions: [un]
185
+ mday: 10
186
+ - name: International Migrants Day
187
+ regions: [un]
188
+ mday: 18
@@ -1,56 +1,56 @@
1
- # UPS holiday definitions for the Ruby Holiday gem.
2
- #
3
- # By Tim Anglade
4
- #
5
- # Updated: 2008-09-23.
6
- # Source: http://www.ups.com/content/us/en/resources/ship/imp_exp/operation.html
7
- ---
8
- months:
9
- 1:
10
- - name: New Year's Day
11
- regions: [ups]
12
- mday: 1
13
- observed: to_weekday_if_weekend
14
- 5:
15
- - name: Memorial Day
16
- week: -1
17
- regions: [ups]
18
- wday: 1
19
- 7:
20
- - name: Independence Day
21
- regions: [ups]
22
- mday: 4
23
- observed: to_weekday_if_weekend
24
- 9:
25
- - name: Labor Day
26
- week: 1
27
- regions: [ups]
28
- wday: 1
29
- 11:
30
- - name: Thanksgiving
31
- week: 4
32
- regions: [ups]
33
- wday: 4
34
- - name: Day After Thanksgiving
35
- week: 4
36
- regions: [ups]
37
- wday: 5
38
- 12:
39
- - name: Christmas Day
40
- regions: [ups]
41
- mday: 25
42
- observed: to_weekday_if_weekend
43
- - name: New Year's Eve
44
- regions: [ups]
45
- mday: 31
46
- tests: |
47
- {Date.civil(2008,1,1) => 'New Year\'s Day',
48
- Date.civil(2008,5,26) => 'Memorial Day',
49
- Date.civil(2008,7,4) => 'Independence Day',
50
- Date.civil(2008,9,1) => 'Labor Day',
51
- Date.civil(2008,11,27) => 'Thanksgiving',
52
- Date.civil(2008,11,28) => 'Day After Thanksgiving',
53
- Date.civil(2008,12,25) => 'Christmas Day',
54
- Date.civil(2008,12,31) => 'New Year\'s Eve',}.each do |date, name|
55
- assert_equal name, Holidays.on(date, :ups)[0][:name]
1
+ # UPS holiday definitions for the Ruby Holiday gem.
2
+ #
3
+ # By Tim Anglade
4
+ #
5
+ # Updated: 2008-09-23.
6
+ # Source: http://www.ups.com/content/us/en/resources/ship/imp_exp/operation.html
7
+ ---
8
+ months:
9
+ 1:
10
+ - name: New Year's Day
11
+ regions: [ups]
12
+ mday: 1
13
+ observed: to_weekday_if_weekend
14
+ 5:
15
+ - name: Memorial Day
16
+ week: -1
17
+ regions: [ups]
18
+ wday: 1
19
+ 7:
20
+ - name: Independence Day
21
+ regions: [ups]
22
+ mday: 4
23
+ observed: to_weekday_if_weekend
24
+ 9:
25
+ - name: Labor Day
26
+ week: 1
27
+ regions: [ups]
28
+ wday: 1
29
+ 11:
30
+ - name: Thanksgiving
31
+ week: 4
32
+ regions: [ups]
33
+ wday: 4
34
+ - name: Day After Thanksgiving
35
+ week: 4
36
+ regions: [ups]
37
+ wday: 5
38
+ 12:
39
+ - name: Christmas Day
40
+ regions: [ups]
41
+ mday: 25
42
+ observed: to_weekday_if_weekend
43
+ - name: New Year's Eve
44
+ regions: [ups]
45
+ mday: 31
46
+ tests: |
47
+ {Date.civil(2008,1,1) => 'New Year\'s Day',
48
+ Date.civil(2008,5,26) => 'Memorial Day',
49
+ Date.civil(2008,7,4) => 'Independence Day',
50
+ Date.civil(2008,9,1) => 'Labor Day',
51
+ Date.civil(2008,11,27) => 'Thanksgiving',
52
+ Date.civil(2008,11,28) => 'Day After Thanksgiving',
53
+ Date.civil(2008,12,25) => 'Christmas Day',
54
+ Date.civil(2008,12,31) => 'New Year\'s Eve',}.each do |date, name|
55
+ assert_equal name, (Holidays.on(date, :ups)[0] || {})[:name]
56
56
  end