holidays 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +7 -0
- data/data/index.yaml +1 -1
- data/lib/holidays/us.rb +23 -23
- data/test/defs/test_defs_us.rb +12 -25
- metadata +6 -4
data/CHANGELOG
ADDED
data/data/index.yaml
CHANGED
@@ -14,7 +14,7 @@ defs:
|
|
14
14
|
MX: ['mx.yaml', 'north_america_informal.yaml']
|
15
15
|
NL: ['nl.yaml']
|
16
16
|
PT: ['se.yaml']
|
17
|
-
US: ['
|
17
|
+
US: ['us.yaml', 'north_america_informal.yaml']
|
18
18
|
United_Nations: ['united_nations.yaml']
|
19
19
|
ZA: ['za.yaml']
|
20
20
|
North_America: ['ca.yaml', 'mx.yaml', 'us.yaml', 'north_america_informal.yaml']
|
data/lib/holidays/us.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Holidays
|
2
2
|
# This file is generated by the Ruby Holiday gem.
|
3
3
|
#
|
4
|
-
# Definitions loaded: data/
|
4
|
+
# Definitions loaded: data/us.yaml, data/north_america_informal.yaml
|
5
5
|
#
|
6
6
|
# To use the definitions in this file, load them right after you load the
|
7
7
|
# Holiday gem:
|
@@ -11,37 +11,37 @@ module Holidays
|
|
11
11
|
#
|
12
12
|
# More definitions are available at http://code.dunae.ca/holidays.
|
13
13
|
module US # :nodoc:
|
14
|
-
DEFINED_REGIONS = [:
|
14
|
+
DEFINED_REGIONS = [:us, :us_dc, :ca]
|
15
15
|
|
16
16
|
HOLIDAYS_BY_MONTH = {
|
17
|
-
5 => [{:wday => 1, :week => 1, :name => "
|
18
|
-
{:wday => 1, :week => 1, :name => "May Day", :regions => [:au_nt]},
|
17
|
+
5 => [{:wday => 1, :week => -1, :name => "Memorial Day", :regions => [:us]},
|
19
18
|
{:wday => 0, :week => 3, :type => :informal, :name => "Father's Day", :regions => [:us, :ca]}],
|
20
|
-
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:
|
21
|
-
|
22
|
-
{:
|
23
|
-
|
24
|
-
|
25
|
-
{:
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
{:mday => 26, :name => "Boxing Day", :regions => [:au]}],
|
31
|
-
2 => [{:mday => 2, :type => :informal, :name => "Groundhog Day", :regions => [:us, :ca]},
|
19
|
+
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :type => :informal, :name => "Good Friday", :regions => [:us]}],
|
20
|
+
11 => [{:mday => 11, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Veterans Day", :regions => [:us]},
|
21
|
+
{:wday => 4, :week => 4, :name => "Thanksgiving", :regions => [:us]}],
|
22
|
+
1 => [{:mday => 1, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "New Year's Day", :regions => [:us]},
|
23
|
+
{:wday => 1, :week => 3, :name => "Martin Luther King, Jr. Day", :regions => [:us]},
|
24
|
+
{:function => lambda { |year| Holidays.us_inauguration_day(year) }, :function_id => "us_inauguration_day(year)", :name => "Inauguration Day", :regions => [:us_dc]}],
|
25
|
+
12 => [{:mday => 25, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Christmas Day", :regions => [:us]}],
|
26
|
+
7 => [{:mday => 4, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Independence Day", :regions => [:us]}],
|
27
|
+
2 => [{:wday => 1, :week => 3, :name => "Presidents' Day", :regions => [:us]},
|
28
|
+
{:mday => 2, :type => :informal, :name => "Groundhog Day", :regions => [:us, :ca]},
|
32
29
|
{:mday => 14, :type => :informal, :name => "Valentine's Day", :regions => [:us, :ca]}],
|
33
|
-
3 => [{:
|
34
|
-
|
35
|
-
|
36
|
-
{:mday => 17, :type => :informal, :name => "St. Patrick's Day", :regions => [:us, :ca]}],
|
37
|
-
4 => [{:mday => 25, :name => "ANZAC Day", :regions => [:au]},
|
38
|
-
{:mday => 1, :type => :informal, :name => "April Fool's Day", :regions => [:us, :ca]},
|
30
|
+
3 => [{:mday => 17, :type => :informal, :name => "St. Patrick's Day", :regions => [:us, :ca]}],
|
31
|
+
9 => [{:wday => 1, :week => 1, :name => "Labor Day", :regions => [:us]}],
|
32
|
+
4 => [{:mday => 1, :type => :informal, :name => "April Fool's Day", :regions => [:us, :ca]},
|
39
33
|
{:mday => 22, :type => :informal, :name => "Earth Day", :regions => [:us, :ca]}],
|
40
|
-
10 => [{:wday => 1, :week =>
|
34
|
+
10 => [{:wday => 1, :week => 2, :name => "Columbus Day", :regions => [:us]},
|
41
35
|
{:mday => 31, :type => :informal, :name => "Halloween", :regions => [:us, :ca]}]
|
42
36
|
}
|
43
37
|
end
|
44
38
|
|
39
|
+
# January 20, every fourth year, following Presidential election
|
40
|
+
def self.us_inauguration_day(year)
|
41
|
+
year % 4 == 1 ? 20 : nil
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
45
|
|
46
46
|
end
|
47
47
|
|
data/test/defs/test_defs_us.rb
CHANGED
@@ -3,34 +3,21 @@ require 'holidays/us'
|
|
3
3
|
|
4
4
|
# This file is generated by the Ruby Holiday gem.
|
5
5
|
#
|
6
|
-
# Definitions loaded: data/
|
6
|
+
# Definitions loaded: data/us.yaml, data/north_america_informal.yaml
|
7
7
|
class UsDefinitionTests < Test::Unit::TestCase # :nodoc:
|
8
8
|
|
9
9
|
def test_us
|
10
|
-
{Date.civil(
|
11
|
-
Date.civil(
|
12
|
-
Date.civil(
|
13
|
-
Date.civil(
|
14
|
-
Date.civil(
|
15
|
-
Date.civil(
|
16
|
-
Date.civil(
|
17
|
-
|
10
|
+
{Date.civil(2008,1,1) => 'New Year\'s Day',
|
11
|
+
Date.civil(2008,1,21) => 'Martin Luther King, Jr. Day',
|
12
|
+
Date.civil(2008,2,18) => 'Presidents\' Day',
|
13
|
+
Date.civil(2008,5,26) => 'Memorial Day',
|
14
|
+
Date.civil(2008,7,4) => 'Independence Day',
|
15
|
+
Date.civil(2008,9,1) => 'Labor Day',
|
16
|
+
Date.civil(2008,10,13) => 'Columbus Day',
|
17
|
+
Date.civil(2008,11,11) => 'Veterans Day',
|
18
|
+
Date.civil(2008,11,27) => 'Thanksgiving',
|
19
|
+
Date.civil(2008,12,25) => 'Christmas Day'}.each do |date, name|
|
20
|
+
assert_equal name, Holidays.on(date, :us)[0][:name]
|
18
21
|
end
|
19
|
-
|
20
|
-
[:au_sa, :au_act, :au_nsw, :au_].each do |r|
|
21
|
-
assert_equal 'Labour Day', Date.civil(2007,10,1).holidays(r)[0][:name]
|
22
|
-
end
|
23
|
-
|
24
|
-
[:au_sa, :au_act, :au_nsw, :au_vic, :au_tas, :au_qld, :au_nt, :au_].each do |r|
|
25
|
-
assert_equal 'Queen\'s Birthday', Date.civil(2007,6,11).holidays(r)[0][:name]
|
26
|
-
end
|
27
|
-
|
28
|
-
assert_equal 'Labour Day', Date.civil(2007,3,5).holidays(:au_wa)[0][:name]
|
29
|
-
assert_equal 'Labour Day', Date.civil(2007,3,12).holidays(:au_vic)[0][:name]
|
30
|
-
assert_equal 'Labour Day', Date.civil(2007,5,7).holidays(:au_qld)[0][:name]
|
31
|
-
|
32
|
-
assert_equal 'May Day', Date.civil(2007,5,7).holidays(:au_nt)[0][:name]
|
33
|
-
|
34
|
-
assert_equal 'Eight Hours Day', Date.civil(2007,3,12).holidays(:au_tas)[0][:name]
|
35
22
|
end
|
36
23
|
end
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.
|
2
|
+
rubygems_version: 0.9.2
|
3
3
|
specification_version: 1
|
4
4
|
name: holidays
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.9.
|
7
|
-
date:
|
6
|
+
version: 0.9.1
|
7
|
+
date: 2008-01-14 00:00:00 -08:00
|
8
8
|
summary: A collection of Ruby methods to deal with statutory and other holidays. You deserve a holiday!
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -30,7 +30,6 @@ authors:
|
|
30
30
|
- Alex Dunae
|
31
31
|
files:
|
32
32
|
- lib/holidays
|
33
|
-
- lib/holidays.rb
|
34
33
|
- lib/holidays/au.rb
|
35
34
|
- lib/holidays/ca.rb
|
36
35
|
- lib/holidays/de.rb
|
@@ -52,6 +51,7 @@ files:
|
|
52
51
|
- lib/holidays/united_nations.rb
|
53
52
|
- lib/holidays/us.rb
|
54
53
|
- lib/holidays/za.rb
|
54
|
+
- lib/holidays.rb
|
55
55
|
- data/au.yaml
|
56
56
|
- data/build_defs.rb
|
57
57
|
- data/ca.yaml
|
@@ -75,6 +75,7 @@ files:
|
|
75
75
|
- data/za.yaml
|
76
76
|
- README
|
77
77
|
- REFERENCES
|
78
|
+
- CHANGELOG
|
78
79
|
- LICENSE
|
79
80
|
test_files:
|
80
81
|
- test/defs/test_defs_au.rb
|
@@ -107,6 +108,7 @@ extra_rdoc_files:
|
|
107
108
|
- data/SYNTAX
|
108
109
|
- lib/holidays/MANIFEST
|
109
110
|
- REFERENCES
|
111
|
+
- CHANGELOG
|
110
112
|
- LICENSE
|
111
113
|
executables: []
|
112
114
|
|