Handle not requiring the locale off the bat.
This commit is contained in:
parent
0a3e9aa10a
commit
328584540d
2 changed files with 3 additions and 3 deletions
|
@ -134,7 +134,6 @@ EOM
|
||||||
unless test_strs.empty?
|
unless test_strs.empty?
|
||||||
test_src =<<-EndOfTests
|
test_src =<<-EndOfTests
|
||||||
require File.dirname(__FILE__) + '/../test_helper'
|
require File.dirname(__FILE__) + '/../test_helper'
|
||||||
require 'holidays/#{module_name.downcase}'
|
|
||||||
|
|
||||||
# This file is generated by the Ruby Holiday gem.
|
# This file is generated by the Ruby Holiday gem.
|
||||||
#
|
#
|
||||||
|
|
|
@ -83,6 +83,8 @@ module Holidays
|
||||||
# => [{:name => 'Canada Day', :regions => [:ca]...}
|
# => [{:name => 'Canada Day', :regions => [:ca]...}
|
||||||
# {:name => 'Independence Day'', :regions => [:us], ...}]
|
# {:name => 'Independence Day'', :regions => [:us], ...}]
|
||||||
def self.between(start_date, end_date, *options)
|
def self.between(start_date, end_date, *options)
|
||||||
|
start_date = start_date.to_date if start_date.respond_to?(:to_date)
|
||||||
|
end_date = end_date.to_date if end_date.respond_to?(:to_date)
|
||||||
regions, observed, informal = parse_options(options)
|
regions, observed, informal = parse_options(options)
|
||||||
holidays = []
|
holidays = []
|
||||||
|
|
||||||
|
@ -257,8 +259,7 @@ private
|
||||||
|
|
||||||
regions.flatten!
|
regions.flatten!
|
||||||
|
|
||||||
raise UnknownRegionError unless regions.all? { |r| r == :any or @@regions.include?(r) }
|
raise UnknownRegionError unless regions.all? { |r| r == :any or @@regions.include?(r) or begin require "holidays/#{r.to_s}"; rescue LoadError; false; end }
|
||||||
|
|
||||||
regions
|
regions
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue