Skip to content

Commit

Permalink
Issue-98: remove inauguration day from US Federal Reserve holiday def…
Browse files Browse the repository at this point in the history
…initions
  • Loading branch information
Phil Trimble committed Mar 18, 2015
1 parent f1dd101 commit 6396cd2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 27 deletions.
15 changes: 1 addition & 14 deletions data/federal_reserve.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ months:
week: 3
wday: 1
regions: [federal_reserve]
- name: Inauguration Day
function: us_inauguration_day(year)
regions: [federal_reserve]
2:
- name: Washington's Birthday
week: 3
Expand Down Expand Up @@ -57,14 +54,6 @@ months:
regions: [federal_reserve]
mday: 25
observed: to_monday_if_sunday
methods:
us_inauguration_day: |
# January 20, every fourth year, following Presidential election
def self.us_inauguration_day(year)
year % 4 == 1 ? 20 : nil
end
tests: |
{Date.civil(2012,1,2) => "New Year's Day",
Date.civil(2012,1,16) => "Birthday of Martin Luther King, Jr",
Expand All @@ -87,7 +76,7 @@ tests: |
Date.civil(2013,11,11) => "Veterans Day",
Date.civil(2013,11,28) => "Thanksgiving Day",
Date.civil(2013,12,25) => "Christmas Day",
Date.civil(2014,1,1) => "New Year's Day",
Date.civil(2014,1,20) => "Birthday of Martin Luther King, Jr",
Date.civil(2014,2,17) => "Washington's Birthday",
Expand Down Expand Up @@ -120,8 +109,6 @@ tests: |
Date.civil(2016,11,11) => "Veterans Day",
Date.civil(2016,11,24) => "Thanksgiving Day",
Date.civil(2016,12,26) => "Christmas Day",
Date.civil(2017,1, 20) => "Inauguration Day",
}.each do |date, name|
assert_equal name, (Holidays.on(date, :federal_reserve, :observed)[0] || {})[:name]
end
11 changes: 1 addition & 10 deletions lib/holidays/federal_reserve.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ def self.defined_regions
def self.holidays_by_month
{
1 => [{:mday => 1, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "New Year's Day", :regions => [:federal_reserve]},
{:wday => 1, :week => 3, :name => "Birthday of Martin Luther King, Jr", :regions => [:federal_reserve]},
{:function => lambda { |year| Holidays.us_inauguration_day(year) }, :function_id => "us_inauguration_day(year)", :name => "Inauguration Day", :regions => [:federal_reserve]}],
{:wday => 1, :week => 3, :name => "Birthday of Martin Luther King, Jr", :regions => [:federal_reserve]}],
2 => [{:wday => 1, :week => 3, :name => "Washington's Birthday", :regions => [:federal_reserve]}],
5 => [{:wday => 1, :week => -1, :name => "Memorial Day", :regions => [:federal_reserve]}],
7 => [{:mday => 4, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Independence Day", :regions => [:federal_reserve]}],
Expand All @@ -33,14 +32,6 @@ def self.holidays_by_month
end
end

# January 20, every fourth year, following Presidential election
def self.us_inauguration_day(year)
year % 4 == 1 ? 20 : nil
end





end

Expand Down
4 changes: 1 addition & 3 deletions test/defs/test_defs_federal_reserve.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def test_federal_reserve
Date.civil(2013,11,11) => "Veterans Day",
Date.civil(2013,11,28) => "Thanksgiving Day",
Date.civil(2013,12,25) => "Christmas Day",

Date.civil(2014,1,1) => "New Year's Day",
Date.civil(2014,1,20) => "Birthday of Martin Luther King, Jr",
Date.civil(2014,2,17) => "Washington's Birthday",
Expand Down Expand Up @@ -61,8 +61,6 @@ def test_federal_reserve
Date.civil(2016,11,11) => "Veterans Day",
Date.civil(2016,11,24) => "Thanksgiving Day",
Date.civil(2016,12,26) => "Christmas Day",

Date.civil(2017,1, 20) => "Inauguration Day",
}.each do |date, name|
assert_equal name, (Holidays.on(date, :federal_reserve, :observed)[0] || {})[:name]
end
Expand Down

0 comments on commit 6396cd2

Please sign in to comment.