bjeanes-holidays 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. data/CHANGELOG +15 -0
  2. data/LICENSE +21 -0
  3. data/README.rdoc +77 -0
  4. data/REFERENCES +16 -0
  5. data/data/SYNTAX +111 -0
  6. data/data/au.yaml +111 -0
  7. data/data/build_defs.rb +152 -0
  8. data/data/ca.yaml +141 -0
  9. data/data/de.yaml +111 -0
  10. data/data/dk.yaml +117 -0
  11. data/data/es.yaml +161 -0
  12. data/data/fr.yaml +70 -0
  13. data/data/gb.yaml +106 -0
  14. data/data/ie.yaml +58 -0
  15. data/data/index.yaml +23 -0
  16. data/data/is.yaml +136 -0
  17. data/data/it.yaml +66 -0
  18. data/data/mx.yaml +106 -0
  19. data/data/nl.yaml +67 -0
  20. data/data/north_america_informal.yaml +49 -0
  21. data/data/nyse.yaml +63 -0
  22. data/data/pt.yaml +85 -0
  23. data/data/se.yaml +91 -0
  24. data/data/united_nations.yaml +188 -0
  25. data/data/ups.yaml +56 -0
  26. data/data/us.yaml +81 -0
  27. data/data/za.yaml +78 -0
  28. data/lib/holidays.rb +404 -0
  29. data/lib/holidays/MANIFEST +25 -0
  30. data/lib/holidays/au.rb +42 -0
  31. data/lib/holidays/ca.rb +68 -0
  32. data/lib/holidays/de.rb +50 -0
  33. data/lib/holidays/dk.rb +47 -0
  34. data/lib/holidays/es.rb +52 -0
  35. data/lib/holidays/europe.rb +214 -0
  36. data/lib/holidays/fr.rb +36 -0
  37. data/lib/holidays/gb.rb +40 -0
  38. data/lib/holidays/ie.rb +32 -0
  39. data/lib/holidays/is.rb +61 -0
  40. data/lib/holidays/it.rb +35 -0
  41. data/lib/holidays/mx.rb +51 -0
  42. data/lib/holidays/nl.rb +36 -0
  43. data/lib/holidays/north_america.rb +107 -0
  44. data/lib/holidays/nyse.rb +32 -0
  45. data/lib/holidays/pt.rb +43 -0
  46. data/lib/holidays/scandinavia.rb +114 -0
  47. data/lib/holidays/se.rb +52 -0
  48. data/lib/holidays/united_nations.rb +24 -0
  49. data/lib/holidays/ups.rb +31 -0
  50. data/lib/holidays/us.rb +48 -0
  51. data/lib/holidays/za.rb +35 -0
  52. data/rakefile.rb +150 -0
  53. data/test/defs/test_defs_au.rb +36 -0
  54. data/test/defs/test_defs_ca.rb +29 -0
  55. data/test/defs/test_defs_de.rb +49 -0
  56. data/test/defs/test_defs_dk.rb +30 -0
  57. data/test/defs/test_defs_es.rb +57 -0
  58. data/test/defs/test_defs_europe.rb +243 -0
  59. data/test/defs/test_defs_fr.rb +26 -0
  60. data/test/defs/test_defs_gb.rb +36 -0
  61. data/test/defs/test_defs_ie.rb +21 -0
  62. data/test/defs/test_defs_is.rb +33 -0
  63. data/test/defs/test_defs_it.rb +25 -0
  64. data/test/defs/test_defs_mx.rb +22 -0
  65. data/test/defs/test_defs_nl.rb +24 -0
  66. data/test/defs/test_defs_north_america.rb +54 -0
  67. data/test/defs/test_defs_nyse.rb +22 -0
  68. data/test/defs/test_defs_pt.rb +56 -0
  69. data/test/defs/test_defs_scandinavia.rb +75 -0
  70. data/test/defs/test_defs_se.rb +32 -0
  71. data/test/defs/test_defs_ups.rb +21 -0
  72. data/test/defs/test_defs_us.rb +23 -0
  73. data/test/defs/test_defs_za.rb +25 -0
  74. metadata +132 -0
data/data/mx.yaml ADDED
@@ -0,0 +1,106 @@
1
+ # Mexican holiday definitions for the Ruby Holiday gem.
2
+ # Updated 2008-12-05.
3
+ # Sources:
4
+ # - http://www.britishembassy.gov.uk/servlet/Front?pagename=OpenMarket/Xcelerate/ShowPage&c=Page&cid=1125561634963
5
+ # - http://www.usembassy-mexico.gov/eng/holidays.html
6
+ ---
7
+ months:
8
+ 1:
9
+ - name: Año nuevo
10
+ regions: [mx]
11
+ mday: 1
12
+ - name: Dia de los Santos Reyes
13
+ regions: [mx]
14
+ mday: 6
15
+ 2:
16
+ - name: Día de la Constitución
17
+ week: 1
18
+ regions: [mx]
19
+ wday: 1
20
+ 3:
21
+ - name: Natalicio de Benito Juárez
22
+ week: 3
23
+ regions: [mx]
24
+ wday: 1
25
+ 4:
26
+ - name: Día del Niño
27
+ regions: [mx]
28
+ mday: 30
29
+ type: informal
30
+ 5:
31
+ - name: Día del Trabajo
32
+ regions: [mx]
33
+ mday: 1
34
+ - name: Cinco de Mayo
35
+ regions: [mx]
36
+ mday: 5
37
+ type: informal
38
+ - name: La Batalla de Puebla
39
+ regions: [mx_pue]
40
+ mday: 5
41
+ - name: Día de la Madre
42
+ regions: [mx]
43
+ mday: 10
44
+ type: informal
45
+ - name: Día del Maestro
46
+ regions: [mx]
47
+ mday: 15
48
+ type: informal
49
+ 6:
50
+ - name: Día del Padre
51
+ regions: [mx]
52
+ wday: 0
53
+ week: 3
54
+ type: informal
55
+ 9:
56
+ - name: Grito de Dolores
57
+ regions: [mx]
58
+ mday: 15
59
+ - name: Día de la Independencia
60
+ regions: [mx]
61
+ mday: 16
62
+ 10:
63
+ - name: Día de la Raza
64
+ regions: [mx]
65
+ mday: 12
66
+ type: informal
67
+ 11:
68
+ - name: Todos los Santos
69
+ regions: [mx]
70
+ mday: 1
71
+ type: informal
72
+ - name: Los Fieles Difuntos
73
+ regions: [mx]
74
+ mday: 2
75
+ type: informal
76
+ - name: Día de la Revolución
77
+ week: 3
78
+ regions: [mx]
79
+ wday: 1
80
+ 12:
81
+ - name: Día de la Virgen de Guadalupe
82
+ regions: [mx]
83
+ mday: 12
84
+ type: informal
85
+ - name: Nochebuena
86
+ regions: [mx]
87
+ mday: 24
88
+ type: informal
89
+ - name: Navidad
90
+ regions: [mx]
91
+ mday: 25
92
+ - name: Los Santos Inocentes
93
+ regions: [mx]
94
+ mday: 28
95
+ tests: |
96
+ {Date.civil(2007,1,1) => 'Año nuevo',
97
+ Date.civil(2007,2,5) => 'Día de la Constitución',
98
+ Date.civil(2007,5,1) => 'Día del Trabajo',
99
+ Date.civil(2007,5,5) => 'Cinco de Mayo',
100
+ Date.civil(2007,9,16) => 'Día de la Independencia',
101
+ Date.civil(2007,11,1) => 'Todos los Santos',
102
+ Date.civil(2007,11,2) => 'Los Fieles Difuntos',
103
+ Date.civil(2007,11,19) => 'Día de la Revolución',
104
+ Date.civil(2007,12,25) => 'Navidad'}.each do |date, name|
105
+ assert_equal name, Holidays.on(date, :mx, :informal)[0][:name]
106
+ end
data/data/nl.yaml ADDED
@@ -0,0 +1,67 @@
1
+ # Dutch holiday definitions for the Ruby Holiday gem.
2
+ #
3
+ # Updated: 2008-11-23.
4
+ # Sources:
5
+ # - http://en.wikipedia.org/wiki/Public_holidays_in_the_Netherlands
6
+ # - http://www.buyusa.gov/netherlands/en/dutch_holidays.html
7
+ ---
8
+ months:
9
+ 0:
10
+ - name: Goede Vrijdag
11
+ regions: [nl]
12
+ function: easter(year)-2
13
+ - name: Pasen
14
+ regions: [nl]
15
+ function: easter(year)
16
+ - name: Pasen
17
+ regions: [nl]
18
+ function: easter(year)+1
19
+ - name: Hemelvaartsdag
20
+ regions: [nl]
21
+ function: easter(year)+39
22
+ - name: Pinksteren
23
+ regions: [nl]
24
+ function: easter(year)+49
25
+ - name: Pinksteren
26
+ regions: [nl]
27
+ function: easter(year)+50
28
+ 1:
29
+ - name: Nieuwjaar
30
+ regions: [nl]
31
+ mday: 1
32
+ 4:
33
+ - name: Koninginnedag
34
+ regions: [nl]
35
+ mday: 30
36
+ 5:
37
+ - name: Dodenherdenking
38
+ regions: [nl]
39
+ mday: 4
40
+ - name: Bevrijdingsdag
41
+ regions: [nl]
42
+ mday: 5
43
+ 12:
44
+ - name: Sinterklaas
45
+ regions: [nl]
46
+ mday: 5
47
+ type: informal
48
+ - name: Kerstmis
49
+ regions: [nl]
50
+ mday: 25
51
+ - name: Kerstmis
52
+ regions: [nl]
53
+ mday: 26
54
+ tests: |
55
+ {Date.civil(2008,1,1) => 'Nieuwjaar',
56
+ Date.civil(2008,3,21) => 'Goede Vrijdag',
57
+ Date.civil(2008,3,23) => 'Pasen',
58
+ Date.civil(2008,3,24) => 'Pasen',
59
+ Date.civil(2008,4,30) => 'Koninginnedag',
60
+ Date.civil(2008,5,1) => 'Hemelvaartsdag', # Ascension, Easter+39
61
+ Date.civil(2008,5,5) => 'Bevrijdingsdag',
62
+ Date.civil(2008,5,11) => 'Pinksteren', # Pentecost, Easter+49
63
+ Date.civil(2008,5,12) => 'Pinksteren', # Pentecost, Easter+50
64
+ Date.civil(2008,12,25) => 'Kerstmis',
65
+ Date.civil(2008,12,26) => 'Kerstmis'}.each do |date, name|
66
+ assert_equal name, Holidays.on(date, :nl, :informal)[0][:name]
67
+ end
@@ -0,0 +1,49 @@
1
+ # Informal North American holiday definitions for the Ruby Holiday gem.
2
+ # Updated 2008-11-22.
3
+ ---
4
+ months:
5
+ 2:
6
+ - name: Groundhog Day
7
+ regions: [us, ca]
8
+ mday: 2
9
+ type: informal
10
+ - name: Valentine's Day
11
+ regions: [us, ca]
12
+ mday: 14
13
+ type: informal
14
+ 3:
15
+ - name: St. Patrick's Day
16
+ regions: [us, ca]
17
+ mday: 17
18
+ type: informal
19
+ 4:
20
+ - name: April Fool's Day
21
+ regions: [us, ca]
22
+ mday: 1
23
+ type: informal
24
+ - name: Earth Day
25
+ regions: [us, ca]
26
+ mday: 22
27
+ type: informal
28
+ 5:
29
+ - name: Mother's Day
30
+ week: 2
31
+ regions: [us, ca]
32
+ wday: 0
33
+ type: informal
34
+ - name: Armed Forces Day
35
+ week: 3
36
+ regions: [us]
37
+ wday: 6
38
+ type: informal
39
+ 5:
40
+ - name: Father's Day
41
+ week: 3
42
+ regions: [us, ca]
43
+ wday: 0
44
+ type: informal
45
+ 10:
46
+ - name: Halloween
47
+ regions: [us, ca]
48
+ mday: 31
49
+ type: informal
data/data/nyse.yaml ADDED
@@ -0,0 +1,63 @@
1
+ # NYSE holiday definitions for the Ruby Holiday gem.
2
+ #
3
+ # By Alan Larkin
4
+ # Source: http://www.nyse.com/about/newsevents/1176373643795.html#earlyclose2008
5
+ #
6
+ # Updated 2008-11-19.
7
+ ---
8
+ months:
9
+ 0:
10
+ - name: Good Friday
11
+ regions: [nyse]
12
+ function: easter(year)-2
13
+ 1:
14
+ - name: New Year's Day
15
+ regions: [nyse]
16
+ mday: 1
17
+ - name: Martin Luther King, Jr. Day
18
+ week: 3
19
+ regions: [nyse]
20
+ wday: 1
21
+ 2:
22
+ - name: Presidents' Day
23
+ week: 3
24
+ regions: [nyse]
25
+ wday: 1
26
+ 5:
27
+ - name: Memorial Day
28
+ week: -1
29
+ regions: [nyse]
30
+ wday: 1
31
+ 7:
32
+ - name: Independence Day
33
+ regions: [nyse]
34
+ mday: 4
35
+ observed: to_weekday_if_weekend
36
+ 9:
37
+ - name: Labor Day
38
+ week: 1
39
+ regions: [nyse]
40
+ wday: 1
41
+ 11:
42
+ - name: Thanksgiving
43
+ week: 4
44
+ regions: [nyse]
45
+ wday: 4
46
+ 12:
47
+ - name: Christmas Day
48
+ regions: [nyse]
49
+ mday: 25
50
+ observed: to_weekday_if_weekend
51
+ methods:
52
+ tests: |
53
+ {Date.civil(2008,1,1) => 'New Year\'s Day',
54
+ Date.civil(2008,1,21) => 'Martin Luther King, Jr. Day',
55
+ Date.civil(2008,2,18) => 'Presidents\' Day',
56
+ Date.civil(2008,3,21) => 'Good Friday',
57
+ Date.civil(2008,5,26) => 'Memorial Day',
58
+ Date.civil(2008,7,4) => 'Independence Day',
59
+ Date.civil(2008,9,1) => 'Labor Day',
60
+ Date.civil(2008,11,27) => 'Thanksgiving',
61
+ Date.civil(2008,12,25) => 'Christmas Day'}.each do |date, name|
62
+ assert_equal name, Holidays.on(date, :nyse)[0][:name]
63
+ end
data/data/pt.yaml ADDED
@@ -0,0 +1,85 @@
1
+ # Portugese holiday definitions for the Ruby Holiday gem.
2
+ #
3
+ # Updated: 2008-11-28.
4
+ # Sources:
5
+ # - http://en.wikipedia.org/wiki/Holidays_in_Portugal
6
+ # - http://www.kidlink.org/KIDPROJ/MCC/mcc0006.html
7
+ # - http://www.worldtravelguide.net/country/227/public_holidays/Europe/Portugal.html
8
+ # - http://en.wikipedia.org/wiki/Portugal_Day
9
+ # - http://www.timeanddate.com/calendar/custom.html?year=2008&country=15
10
+ ---
11
+ months:
12
+ 0:
13
+ - name: Carnaval # same as Shrove Tuesday
14
+ regions: [pt]
15
+ function: easter(year)-47
16
+ type: informal
17
+ - name: Sexta-feira Santa
18
+ regions: [pt]
19
+ function: easter(year)-2
20
+ - name: Páscoa
21
+ regions: [pt]
22
+ function: easter(year)
23
+ - name: Corpo de Deus
24
+ regions: [pt]
25
+ function: easter(year)+60
26
+ 1:
27
+ - name: Ano Novo
28
+ regions: [pt]
29
+ mday: 1
30
+ 4:
31
+ - name: Dia da Liberdade
32
+ regions: [pt]
33
+ mday: 25
34
+ 5:
35
+ - name: Dia do Trabalhador
36
+ regions: [pt]
37
+ mday: 1
38
+ 6:
39
+ - name: Dia de Portugal
40
+ regions: [pt]
41
+ mday: 10
42
+ 8:
43
+ - name: Assunção de Nossa Senhora
44
+ regions: [pt]
45
+ mday: 15
46
+ 10:
47
+ - name: Implantação da República
48
+ regions: [pt]
49
+ mday: 5
50
+ 11:
51
+ - name: Todos os Santos
52
+ regions: [pt]
53
+ mday: 1
54
+ 12:
55
+ - name: Restauração da Independência
56
+ regions: [pt]
57
+ mday: 1
58
+ - name: Imaculada Conceição
59
+ regions: [pt]
60
+ mday: 8
61
+ - name: Natal
62
+ regions: [pt]
63
+ mday: 25
64
+ tests: |
65
+ {Date.civil(2008,1,1) => 'Ano Novo',
66
+ Date.civil(2005,2,8) => 'Carnaval',
67
+ Date.civil(2006,2,28) => 'Carnaval',
68
+ Date.civil(2007,2,20) => 'Carnaval',
69
+ Date.civil(2008,2,5) => 'Carnaval',
70
+ Date.civil(2008,3,21) => 'Sexta-feira Santa',
71
+ Date.civil(2008,3,23) => 'Páscoa',
72
+ Date.civil(2008,4,25) => 'Dia da Liberdade',
73
+ Date.civil(2008,5,1) => 'Dia do Trabalhador',
74
+ Date.civil(2005,5,26) => 'Corpo de Deus',
75
+ Date.civil(2007,6,7) => 'Corpo de Deus',
76
+ Date.civil(2008,5,22) => 'Corpo de Deus',
77
+ Date.civil(2008,6,10) => 'Dia de Portugal',
78
+ Date.civil(2008,8,15) => 'Assunção de Nossa Senhora',
79
+ Date.civil(2008,10,5) => 'Implantação da República',
80
+ Date.civil(2008,11,1) => 'Todos os Santos',
81
+ Date.civil(2008,12,1) => 'Restauração da Independência',
82
+ Date.civil(2008,12,8) => 'Imaculada Conceição',
83
+ Date.civil(2008,12,25) => 'Natal'}.each do |date, name|
84
+ assert_equal name, Holidays.on(date, :pt, :informal)[0][:name]
85
+ end
data/data/se.yaml ADDED
@@ -0,0 +1,91 @@
1
+ # Swedish holiday definitions for the Ruby Holiday gem.
2
+ #
3
+ # Updated: 2008-11-28.
4
+ # Sources:
5
+ # - http://en.wikipedia.org/wiki/Holidays_in_Sweden
6
+ # - http://www.worldtravelguide.net/country/269/public_holidays/Europe/Sweden.html
7
+ # - http://hem.passagen.se/farila/midsum.htm
8
+ # - http://www.timeanddate.com/calendar/?country=21
9
+ ---
10
+ months:
11
+ 0:
12
+ - name: Långfredagen
13
+ regions: [se]
14
+ function: easter(year)-2
15
+ - name: Påskdagen
16
+ regions: [se]
17
+ function: easter(year)
18
+ - name: Annandag påsk
19
+ regions: [se]
20
+ function: easter(year)+1
21
+ - name: Kristi himmelsfärdsdag # Ascension Day
22
+ regions: [se]
23
+ function: easter(year)+39
24
+ - name: Pingstdagen # Whitsunday
25
+ regions: [se]
26
+ function: easter(year)+49
27
+ - name: Alla helgons dag # All Saint's Day
28
+ regions: [se]
29
+ function: se_alla_helgons_dag(year)
30
+ 1:
31
+ - name: Nyårsdagen
32
+ regions: [se]
33
+ mday: 1
34
+ - name: Trettondedag jul
35
+ regions: [se]
36
+ mday: 6
37
+ 5:
38
+ - name: Första maj
39
+ regions: [se]
40
+ mday: 1
41
+ 6:
42
+ - name: Nationaldagen
43
+ regions: [se]
44
+ mday: 6
45
+ - name: Midsommardagen
46
+ regions: [se]
47
+ function: se_midsommardagen(year)
48
+ 12:
49
+ - name: Juldagen
50
+ regions: [se]
51
+ mday: 25
52
+ - name: Annandag jul
53
+ regions: [se]
54
+ mday: 26
55
+ methods:
56
+ se_midsommardagen: |
57
+ # Sweden: Mid-summer (Saturday between June 20–26)
58
+ def self.se_midsommardagen(year)
59
+ date = Date.civil(year,6,20)
60
+ date += (6 - date.wday)
61
+ date
62
+ end
63
+ se_alla_helgons_dag: |
64
+ # Sweden: All Saint's Day (Saturday between Oct 31 and Nov 6)
65
+ def self.se_alla_helgons_dag(year)
66
+ date = Date.civil(year,10,31)
67
+ date += (6 - date.wday)
68
+ date
69
+ end
70
+ tests: |
71
+ {Date.civil(2008,1,1) => 'Nyårsdagen',
72
+ Date.civil(2008,1,6) => 'Trettondedag jul',
73
+ Date.civil(2008,3,21) => 'Långfredagen',
74
+ Date.civil(2008,3,23) => 'Påskdagen',
75
+ Date.civil(2008,3,24) => 'Annandag påsk',
76
+ Date.civil(2008,5,1) => 'Första maj',
77
+ Date.civil(2008,5,1) => 'Kristi himmelsfärdsdag',
78
+ Date.civil(2008,5,11) => 'Pingstdagen',
79
+ Date.civil(2008,6,6) => 'Nationaldagen',
80
+ Date.civil(2005,6,25) => 'Midsommardagen',
81
+ Date.civil(2006,6,24) => 'Midsommardagen',
82
+ Date.civil(2007,6,23) => 'Midsommardagen',
83
+ Date.civil(2008,6,21) => 'Midsommardagen',
84
+ Date.civil(2005,11,5) => 'Alla helgons dag',
85
+ Date.civil(2006,11,4) => 'Alla helgons dag',
86
+ Date.civil(2007,11,3) => 'Alla helgons dag',
87
+ Date.civil(2008,11,1) => 'Alla helgons dag',
88
+ Date.civil(2008,12,25) => 'Juldagen',
89
+ Date.civil(2008,12,26) => 'Annandag jul'}.each do |date, name|
90
+ assert_equal name, Holidays.on(date, :se, :informal)[0][:name]
91
+ end