diff options
author | Geoff Buesing <gbuesing@gmail.com> | 2008-03-17 05:14:26 +0000 |
---|---|---|
committer | Geoff Buesing <gbuesing@gmail.com> | 2008-03-17 05:14:26 +0000 |
commit | fe7c68ee5d4d78b705bc91c0652b05202b3eb30e (patch) | |
tree | 814e126a4cea6bfb98b84e215d3b6a44d241fc6d | |
parent | 2366fdbdb1e8a5ba4ee07d94e79c2011f5821820 (diff) | |
download | rails-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/CHANGELOG | 2 | ||||
-rw-r--r-- | activesupport/lib/active_support/values/time_zone.rb | 8 |
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 |