wombleton-holidays 0.9.8 → 0.9.9
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/holidays.rb +3 -1
- data/test/test_multiple_regions.rb +4 -2
- data/wombleton-holidays.gemspec +1 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.9
|
data/lib/holidays.rb
CHANGED
@@ -252,6 +252,8 @@ private
|
|
252
252
|
# Found sub region wild-card
|
253
253
|
regions.delete_if do |reg|
|
254
254
|
if reg.to_s =~ /_$/
|
255
|
+
prefix = reg.to_s.split('_').first
|
256
|
+
raise UnknownRegionError unless @@regions.include?(prefix.to_sym) or begin require "holidays/#{prefix}"; rescue LoadError; false; end
|
255
257
|
regions << @@regions.select { |dr| dr.to_s =~ Regexp.new("^#{reg}") }
|
256
258
|
true
|
257
259
|
end
|
@@ -261,7 +263,7 @@ private
|
|
261
263
|
|
262
264
|
require "holidays/north_america" if regions.include?(:us) # special case for north_america/US cross-linking
|
263
265
|
|
264
|
-
raise UnknownRegionError unless regions.all? { |r| r == :any or @@regions.include?(r) or begin require "holidays/#{r.to_s
|
266
|
+
raise UnknownRegionError unless regions.all? { |r| r == :any or @@regions.include?(r) or begin require "holidays/#{r.to_s}"; rescue LoadError; false; end }
|
265
267
|
regions
|
266
268
|
end
|
267
269
|
|
@@ -1,6 +1,4 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/test_helper'
|
2
|
-
require 'holidays/gb'
|
3
|
-
require 'holidays/ie'
|
4
2
|
|
5
3
|
class MultipleRegionsTests < Test::Unit::TestCase
|
6
4
|
def setup
|
@@ -11,6 +9,10 @@ class MultipleRegionsTests < Test::Unit::TestCase
|
|
11
9
|
h = Holidays.on(Date.civil(2008,12,26), :ie)
|
12
10
|
assert_equal 'St. Stephen\'s Day', h[0][:name]
|
13
11
|
|
12
|
+
h = Holidays.on(Date.civil(2008,5,9), :gb_)
|
13
|
+
assert_equal 'Liberation Day', (h[0] || {})[:name]
|
14
|
+
|
15
|
+
|
14
16
|
h = Holidays.on(Date.civil(2008,5,9), :je)
|
15
17
|
assert_equal 'Liberation Day', h[0][:name]
|
16
18
|
|
data/wombleton-holidays.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{wombleton-holidays}
|
8
|
-
s.version = "0.9.
|
8
|
+
s.version = "0.9.9"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Alex Dunae", "Rowan Crawford"]
|