diff options
author | Arthur Neves <arthurnn@gmail.com> | 2015-02-06 22:49:21 -0500 |
---|---|---|
committer | Arthur Neves <arthurnn@gmail.com> | 2015-02-06 22:49:21 -0500 |
commit | b9ba90d59ed28c28c07b04ecdc2035b471aea881 (patch) | |
tree | 35af2ce20161fd4111323c8ca5032fe862a14a71 /activesupport | |
parent | cdd3961e2b9990745a1aaf07e9a6981cd183b820 (diff) | |
parent | 89d48fb342279767b1446c8233ab6abefca7919c (diff) | |
download | rails-b9ba90d59ed28c28c07b04ecdc2035b471aea881.tar.gz rails-b9ba90d59ed28c28c07b04ecdc2035b471aea881.tar.bz2 rails-b9ba90d59ed28c28c07b04ecdc2035b471aea881.zip |
Merge pull request #14252 from mcfiredrill/make-zones-map-private
make zones_map private
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/values/time_zone.rb | 15 | ||||
-rw-r--r-- | activesupport/test/time_zone_test.rb | 3 |
2 files changed, 9 insertions, 9 deletions
diff --git a/activesupport/lib/active_support/values/time_zone.rb b/activesupport/lib/active_support/values/time_zone.rb index 728b53849d..da39f0d245 100644 --- a/activesupport/lib/active_support/values/time_zone.rb +++ b/activesupport/lib/active_support/values/time_zone.rb @@ -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 diff --git a/activesupport/test/time_zone_test.rb b/activesupport/test/time_zone_test.rb index cd7e184cda..7888b9919b 100644 --- a/activesupport/test/time_zone_test.rb +++ b/activesupport/test/time_zone_test.rb @@ -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 |