holiday_tools 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.rspec +1 -1
- data/Gemfile +0 -2
- data/lib/holiday_tools/locator.rb +24 -13
- data/lib/holiday_tools/version.rb +1 -1
- data/lib/holiday_tools.rb +1 -1
- data/spec/holiday_tools/locator_spec.rb +8 -0
- metadata +2 -2
data/.rspec
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
--color
|
2
|
-
--format
|
2
|
+
--format nested
|
data/Gemfile
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
+
# monkey path to see available regions
|
4
|
+
module Holidays
|
5
|
+
def self.regions
|
6
|
+
@@regions
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
3
10
|
module HolidayTools
|
4
11
|
class Locator
|
5
12
|
|
@@ -37,7 +44,7 @@ module HolidayTools
|
|
37
44
|
require "holidays/us"
|
38
45
|
# require "holidays/vz"
|
39
46
|
require "holidays/za"
|
40
|
-
|
47
|
+
|
41
48
|
def initialize( filter=[] )
|
42
49
|
@filter = filter
|
43
50
|
|
@@ -59,15 +66,15 @@ module HolidayTools
|
|
59
66
|
ca_ab: 'Canada/Alberta',
|
60
67
|
ca_bc: 'Canada/British Columbia',
|
61
68
|
ca_mb: 'Canada/Manitoba',
|
62
|
-
|
69
|
+
# ca_nb: 'Canada/New Brunswick',
|
63
70
|
ca_nf: 'Canada/Newfoundland',
|
64
71
|
ca_ns: 'Canada/Nova Scotia',
|
65
72
|
ca_nt: 'Canada/Northwest Territories',
|
66
73
|
ca_nu: 'Canada/Nunavut',
|
67
74
|
ca_on: 'Canada/Ontario',
|
68
|
-
|
69
|
-
ca_sk: 'Canada/Saskatchewan',
|
75
|
+
# ca_pe: 'Canada/Prince Edward Island',
|
70
76
|
ca_qc: 'Canada/Quebeck',
|
77
|
+
ca_sk: 'Canada/Saskatchewan',
|
71
78
|
ca_yk: 'Canada/Yukon',
|
72
79
|
cz: 'Czech Republic',
|
73
80
|
de: 'Germany',
|
@@ -111,15 +118,15 @@ module HolidayTools
|
|
111
118
|
fi: 'Finland',
|
112
119
|
fr: 'France',
|
113
120
|
gb: 'Great Britain',
|
114
|
-
|
115
|
-
gb_wls: 'Great Britain/Wales',
|
121
|
+
gb_con: 'Great Britain/Cornwall',
|
116
122
|
gb_eaw: 'Great Britain/England and Wales',
|
117
|
-
|
118
|
-
gb_sct: 'Great Britain/Scotland',
|
119
|
-
gb_jsy: 'Great Britain/Jersey',
|
123
|
+
gb_eng: 'Great Britain/England',
|
120
124
|
gb_gsy: 'Great Britain/Guernsey',
|
121
|
-
gb_con: 'Great Britain/Cornwall',
|
122
125
|
gb_iom: 'Great Britain/Isle of Man',
|
126
|
+
gb_jsy: 'Great Britain/Jersey',
|
127
|
+
gb_nir: 'Great Britain/Norther Ireland',
|
128
|
+
gb_sct: 'Great Britain/Scotland',
|
129
|
+
gb_wls: 'Great Britain/Wales',
|
123
130
|
gg: 'Guernsey',
|
124
131
|
ie: 'ireland',
|
125
132
|
im: 'Isle of Man',
|
@@ -155,14 +162,18 @@ module HolidayTools
|
|
155
162
|
|
156
163
|
# loop over region names
|
157
164
|
def show_regions
|
165
|
+
regs = Holidays.regions.sort
|
158
166
|
txt = []
|
159
167
|
txt << "Region \tName"
|
160
|
-
|
161
|
-
|
168
|
+
regs.each do |key|
|
169
|
+
name = @reg_names[key]
|
170
|
+
if name
|
171
|
+
txt << "%s \t%s" % [key, name]
|
172
|
+
end
|
162
173
|
end
|
163
174
|
txt
|
164
175
|
end
|
165
|
-
|
176
|
+
|
166
177
|
# get the name of a holiday and the regions, where it is observed
|
167
178
|
def show_holiday(date)
|
168
179
|
ans = Holidays.on(date, :any, :observed)
|
data/lib/holiday_tools.rb
CHANGED
@@ -19,4 +19,12 @@ describe HolidayTools do
|
|
19
19
|
#puts answer[0]
|
20
20
|
answer.flatten!.size.should == 909
|
21
21
|
end
|
22
|
+
|
23
|
+
it 'should list all available regions' do
|
24
|
+
holidays = HolidayTools::Locator.new
|
25
|
+
regions = holidays.show_regions
|
26
|
+
# p regions
|
27
|
+
regions.size.should == 101
|
28
|
+
|
29
|
+
end
|
22
30
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: holiday_tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-06-
|
12
|
+
date: 2013-06-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: holidays
|