Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

load tzinfo on initialize only

Signed-off-by: Xavier Noria <fxn@hashref.com>
  • Loading branch information...
commit d891754535908def1e6777d9bc01ccbe74d70335 1 parent 49943a7
@spastorino spastorino authored fxn committed
Showing with 2 additions and 5 deletions.
  1. +2 −5 activesupport/lib/active_support/values/time_zone.rb
View
7 activesupport/lib/active_support/values/time_zone.rb
@@ -172,6 +172,7 @@ class TimeZone
include Comparable
attr_reader :name
+ attr_reader :tzinfo
# Create a new TimeZone object with the given name and offset. The
# offset is the number of seconds that this time zone is offset from UTC
@@ -180,7 +181,7 @@ class TimeZone
def initialize(name, utc_offset = nil, tzinfo = nil)
@name = name
@utc_offset = utc_offset
- @tzinfo = tzinfo
+ @tzinfo = tzinfo || TimeZone.find_tzinfo(name)
@current_period = nil
end
@@ -292,10 +293,6 @@ def period_for_local(time, dst=true)
tzinfo.period_for_local(time, dst)
end
- def tzinfo
- @tzinfo ||= TimeZone.find_tzinfo(name)
- end
-
# TODO: Preload instead of lazy load for thread safety
def self.find_tzinfo(name)
require 'tzinfo' unless defined?(TZInfo)
Please sign in to comment.
Something went wrong with that request. Please try again.