Skip to content

Commit

Permalink
make zones_map private
Browse files Browse the repository at this point in the history
  • Loading branch information
mcfiredrill committed Mar 3, 2014
1 parent 409fbff commit 184e4de
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
15 changes: 8 additions & 7 deletions activesupport/lib/active_support/values/time_zone.rb
Expand Up @@ -377,13 +377,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
Expand All @@ -410,6 +403,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

private
Expand Down
3 changes: 1 addition & 2 deletions activesupport/test/time_zone_test.rb
Expand Up @@ -395,8 +395,7 @@ def test_unknown_zone_with_utc_offset
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
Expand Down

0 comments on commit 184e4de

Please sign in to comment.