提交 89d48fb3 编写于 作者: T Tony Miller 提交者: Arthur Neves

make zones_map private

Conflicts:
	activesupport/lib/active_support/values/time_zone.rb
上级 cdd3961e
......@@ -224,13 +224,6 @@ def all
@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 @@ def [](arg)
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
......
......@@ -402,8 +402,7 @@ def test_unknown_zone_raises_exception
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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册