aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeoff Buesing <gbuesing@gmail.com>2008-03-17 05:14:26 +0000
committerGeoff Buesing <gbuesing@gmail.com>2008-03-17 05:14:26 +0000
commitfe7c68ee5d4d78b705bc91c0652b05202b3eb30e (patch)
tree814e126a4cea6bfb98b84e215d3b6a44d241fc6d
parent2366fdbdb1e8a5ba4ee07d94e79c2011f5821820 (diff)
downloadrails-fe7c68ee5d4d78b705bc91c0652b05202b3eb30e.tar.gz
rails-fe7c68ee5d4d78b705bc91c0652b05202b3eb30e.tar.bz2
rails-fe7c68ee5d4d78b705bc91c0652b05202b3eb30e.zip
TZInfo caches Timezone instances in its own internal hash cache, so TimeZone::MAPPING doesn't need to cache them as well
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9046 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r--activesupport/CHANGELOG2
-rw-r--r--activesupport/lib/active_support/values/time_zone.rb8
2 files changed, 3 insertions, 7 deletions
diff --git a/activesupport/CHANGELOG b/activesupport/CHANGELOG
index 1b9a30f1b7..8d3a3c2bd0 100644
--- a/activesupport/CHANGELOG
+++ b/activesupport/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* TZInfo caches Timezone instances in its own internal hash cache, so TimeZone::MAPPING doesn't need to cache them as well [Geoff Buesing]
+
* Adding TimeZone#parse [Geoff Buesing]
* Adding TimeZone#at and DateTime#to_f [Geoff Buesing]
diff --git a/activesupport/lib/active_support/values/time_zone.rb b/activesupport/lib/active_support/values/time_zone.rb
index 1d33dcbf32..085fab9731 100644
--- a/activesupport/lib/active_support/values/time_zone.rb
+++ b/activesupport/lib/active_support/values/time_zone.rb
@@ -247,13 +247,7 @@ class TimeZone
end
def tzinfo
- return @tzinfo if @tzinfo
- @tzinfo = MAPPING[name]
- if String === @tzinfo
- @tzinfo = TZInfo::Timezone.get(@tzinfo)
- MAPPING[name] = @tzinfo
- end
- @tzinfo
+ @tzinfo ||= TZInfo::Timezone.get(MAPPING[name])
end
rescue LoadError # Tzinfo gem is not available