1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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