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:
parent
0eca8111f2
commit
1250faa858
2 changed files with 2 additions and 0 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue