Permalink
Browse files

TZInfo caches Timezone instances in its own internal hash cache, so T…

…imeZone::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
  • Loading branch information...
1 parent 2366fdb commit fe7c68ee5d4d78b705bc91c0652b05202b3eb30e @gbuesing gbuesing committed Mar 17, 2008
Showing with 3 additions and 7 deletions.
  1. +2 −0 activesupport/CHANGELOG
  2. +1 −7 activesupport/lib/active_support/values/time_zone.rb
View
@@ -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]
@@ -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

0 comments on commit fe7c68e

Please sign in to comment.