Permalink
Browse files

Rewrite the clause to pluck the existing value from zones_map before …

…performing a lookup. [#4942 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
1 parent ac42e69 commit 78e4d88c7071c633ee1eb68f49b90719aa198eaa @texel texel committed with josevalim Jun 28, 2010
Showing with 4 additions and 2 deletions.
  1. +4 −2 activesupport/lib/active_support/values/time_zone.rb
View
6 activesupport/lib/active_support/values/time_zone.rb
@@ -387,8 +387,10 @@ def zones_map
def [](arg)
case arg
when String
- if tz = lookup(arg)
- zones_map[arg] ||= tz
+ if tz = zones_map[arg]
+ tz
+ elsif tz = lookup(arg)
+ zones_map[arg] = tz
end
when Numeric, ActiveSupport::Duration
arg *= 3600 if arg.abs <= 13

0 comments on commit 78e4d88

Please sign in to comment.