2008-11-20 06:46:34 +01:00
|
|
|
# NYSE holiday definitions for the Ruby Holiday gem.
|
|
|
|
#
|
|
|
|
# By Alan Larkin
|
|
|
|
# Source: http://www.nyse.com/about/newsevents/1176373643795.html#earlyclose2008
|
|
|
|
#
|
|
|
|
# Updated 2008-11-19.
|
|
|
|
---
|
|
|
|
months:
|
|
|
|
0:
|
|
|
|
- name: Good Friday
|
|
|
|
regions: [nyse]
|
|
|
|
function: easter(year)-2
|
|
|
|
1:
|
|
|
|
- name: New Year's Day
|
|
|
|
regions: [nyse]
|
|
|
|
mday: 1
|
|
|
|
- name: Martin Luther King, Jr. Day
|
|
|
|
week: 3
|
|
|
|
regions: [nyse]
|
|
|
|
wday: 1
|
|
|
|
2:
|
|
|
|
- name: Presidents' Day
|
|
|
|
week: 3
|
|
|
|
regions: [nyse]
|
|
|
|
wday: 1
|
|
|
|
5:
|
|
|
|
- name: Memorial Day
|
|
|
|
week: -1
|
|
|
|
regions: [nyse]
|
|
|
|
wday: 1
|
|
|
|
7:
|
|
|
|
- name: Independence Day
|
|
|
|
regions: [nyse]
|
|
|
|
mday: 4
|
|
|
|
observed: to_weekday_if_weekend
|
|
|
|
9:
|
|
|
|
- name: Labor Day
|
|
|
|
week: 1
|
|
|
|
regions: [nyse]
|
|
|
|
wday: 1
|
|
|
|
11:
|
|
|
|
- name: Thanksgiving
|
|
|
|
week: 4
|
|
|
|
regions: [nyse]
|
|
|
|
wday: 4
|
|
|
|
12:
|
|
|
|
- name: Christmas Day
|
|
|
|
regions: [nyse]
|
|
|
|
mday: 25
|
|
|
|
observed: to_weekday_if_weekend
|
|
|
|
methods:
|
|
|
|
tests: |
|
|
|
|
{Date.civil(2008,1,1) => 'New Year\'s Day',
|
|
|
|
Date.civil(2008,1,21) => 'Martin Luther King, Jr. Day',
|
|
|
|
Date.civil(2008,2,18) => 'Presidents\' Day',
|
|
|
|
Date.civil(2008,3,21) => 'Good Friday',
|
|
|
|
Date.civil(2008,5,26) => 'Memorial Day',
|
|
|
|
Date.civil(2008,7,4) => 'Independence Day',
|
|
|
|
Date.civil(2008,9,1) => 'Labor Day',
|
|
|
|
Date.civil(2008,11,27) => 'Thanksgiving',
|
|
|
|
Date.civil(2008,12,25) => 'Christmas Day'}.each do |date, name|
|
2010-04-28 14:50:16 +02:00
|
|
|
assert_equal name, (Holidays.on(date, :nyse)[0] || {})[:name]
|
2008-11-20 06:46:34 +01:00
|
|
|
end
|