Lazy-require tzinfo for TimeZone

This commit is contained in:
Jeremy Kemper
2008-11-23 16:08:00 -08:00
parent 0eca8111f2
commit 1250faa858
2 changed files with 2 additions and 0 deletions

View File

@@ -1,4 +1,5 @@
require 'tzinfo'
module ActiveSupport
# A Time-like class that can represent a time in any time zone. Necessary because standard Ruby Time instances are
# limited to UTC and the system's <tt>ENV['TZ']</tt> zone.

View File

@@ -288,6 +288,7 @@ module ActiveSupport
# TODO: Preload instead of lazy load for thread safety
def tzinfo
require 'tzinfo' unless defined?(TZInfo)
@tzinfo ||= TZInfo::Timezone.get(MAPPING[name])
end