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 ADDED
@@ -0,0 +1,7 @@
1
+ = Ruby Holidays Gem CHANGELOG
2
+
3
+ == 0.9.1
4
+ * au.yaml was being included incorrectly in US holiday definitions. Thanks to Glenn Vanderburg (http://vanderburg.org/) for the fix.
5
+
6
+ == 0.9.0
7
+ * Initial release.
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: ['au.yaml', 'north_america_informal.yaml']
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/au.yaml, data/north_america_informal.yaml
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 = [:au_qld, :au_nt, :au, :au_tas, :au_wa, :au_act, :au_nsw, :au_sa, :au_vic, :us, :ca]
14
+ DEFINED_REGIONS = [:us, :us_dc, :ca]
15
15
 
16
16
  HOLIDAYS_BY_MONTH = {
17
- 5 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:au_qld]},
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 => [:au]},
21
- {:function => lambda { |year| Holidays.easter(year)-1 }, :function_id => "easter(year)-1", :name => "Easter Saturday", :regions => [:au]},
22
- {:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Easter Monday", :regions => [:au]},
23
- {:function => lambda { |year| Holidays.easter(year)+2 }, :function_id => "easter(year)+2", :name => "Easter Monday", :regions => [:au_tas]}],
24
- 6 => [{:wday => 1, :week => 1, :name => "Foundation Day", :regions => [:au_wa]},
25
- {:wday => 1, :week => 2, :name => "Queen's Birthday", :regions => [:au_act, :au_nsw, :au_sa, :au_tas, :au_nt, :au_qld, :au_vic]},
26
- {:mday => 6, :type => :informal, :name => "Queensland Day", :regions => [:au_qld]}],
27
- 1 => [{:mday => 1, :name => "New Year's Day", :regions => [:au]},
28
- {:mday => 26, :name => "Australia Day", :regions => [:au]}],
29
- 12 => [{:mday => 25, :name => "Christmas Day", :regions => [:au]},
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 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:au_wa]},
34
- {:wday => 1, :week => 2, :name => "Eight Hours Day", :regions => [:au_tas]},
35
- {:wday => 1, :week => 2, :name => "Labour Day", :regions => [:au_vic]},
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 => 1, :name => "Labour Day", :regions => [:au_act, :au_nsw, :au_sa]},
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
 
@@ -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/au.yaml, data/north_america_informal.yaml
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(2007,1,1) => 'New Year\'s Day',
11
- Date.civil(2007,1,26) => 'Australia Day',
12
- Date.civil(2007,4,6) => 'Good Friday',
13
- Date.civil(2007,4,9) => 'Easter Monday',
14
- Date.civil(2007,4,25) => 'ANZAC Day',
15
- Date.civil(2007,12,25) => 'Christmas Day',
16
- Date.civil(2007,12,26) => 'Boxing Day'}.each do |date, name|
17
- assert_equal name, Holidays.on(date, :au, :informal)[0][:name]
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.0
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.0
7
- date: 2007-12-19 00:00:00 -08:00
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