mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Memoize coerced TimeWithZone value in TimeWithZone#localtime.
This commit is contained in:
parent
fa9f1538f0
commit
af054a5ae9
1 changed files with 1 additions and 7 deletions
|
@ -80,16 +80,10 @@ module ActiveSupport
|
|||
|
||||
# Returns a <tt>Time</tt> instance of the simultaneous time in the system timezone.
|
||||
def localtime(utc_offset = nil)
|
||||
utc.getlocal(utc_offset)
|
||||
@localtime ||= utc.getlocal(utc_offset)
|
||||
end
|
||||
alias_method :getlocal, :localtime
|
||||
|
||||
def to_time_with_caching
|
||||
@to_time ||= to_time_without_caching
|
||||
end
|
||||
alias_method :to_time_without_caching, :to_time
|
||||
alias_method :to_time, :to_time_with_caching
|
||||
|
||||
# Returns true if the current time is within Daylight Savings Time for the
|
||||
# specified time zone.
|
||||
#
|
||||
|
|
Loading…
Reference in a new issue