From fe7c68ee5d4d78b705bc91c0652b05202b3eb30e Mon Sep 17 00:00:00 2001 From: Geoff Buesing Date: Mon, 17 Mar 2008 05:14:26 +0000 Subject: [PATCH] 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 --- activesupport/CHANGELOG | 2 ++ 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 @@ def period_for_local(time, dst=true) 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