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