make zones_map private

Conflicts:
	activesupport/lib/active_support/values/time_zone.rb
This commit is contained in:
Tony Miller 2014-03-03 16:13:10 +09:00 committed by Arthur Neves
parent cdd3961e2b
commit 89d48fb342
2 changed files with 9 additions and 9 deletions

View File

@ -224,13 +224,6 @@ module ActiveSupport
@zones ||= zones_map.values.sort
end
def zones_map
@zones_map ||= begin
MAPPING.each_key {|place| self[place]} # load all the zones
@lazy_zones_map
end
end
# Locate a specific time zone object. If the argument is a string, it
# is interpreted to mean the name of the timezone to locate. If it is a
# numeric value it is either the hour offset, or the second offset, of the
@ -257,6 +250,14 @@ module ActiveSupport
def us_zones
@us_zones ||= all.find_all { |z| z.name =~ /US|Arizona|Indiana|Hawaii|Alaska/ }
end
private
def zones_map
@zones_map ||= begin
MAPPING.each_key {|place| self[place]} # load all the zones
@lazy_zones_map
end
end
end
include Comparable

View File

@ -402,8 +402,7 @@ class TimeZoneTest < ActiveSupport::TestCase
end
def test_unknown_zones_dont_store_mapping_keys
ActiveSupport::TimeZone["bogus"]
assert !ActiveSupport::TimeZone.zones_map.key?("bogus")
assert_nil ActiveSupport::TimeZone["bogus"]
end
def test_new