mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Lazy-require tzinfo for TimeZone
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user