diff options
author | Ryan De Villa <ryand@nulogy.com> | 2016-08-22 14:57:34 -0400 |
---|---|---|
committer | Ryan De Villa <ryand@nulogy.com> | 2016-08-23 14:07:07 -0400 |
commit | af054a5ae9a60b1a3bc84f0db8b518315d5e172e (patch) | |
tree | f7e0dddedaad1c6c52b5abce16b609d2cc017e8b /activesupport | |
parent | fa9f1538f034667ea5d55838bd46844642b54274 (diff) | |
download | rails-af054a5ae9a60b1a3bc84f0db8b518315d5e172e.tar.gz rails-af054a5ae9a60b1a3bc84f0db8b518315d5e172e.tar.bz2 rails-af054a5ae9a60b1a3bc84f0db8b518315d5e172e.zip |
Memoize coerced TimeWithZone value in TimeWithZone#localtime.
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/time_with_zone.rb | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/activesupport/lib/active_support/time_with_zone.rb b/activesupport/lib/active_support/time_with_zone.rb index f91225289d..74c4a39342 100644 --- a/activesupport/lib/active_support/time_with_zone.rb +++ b/activesupport/lib/active_support/time_with_zone.rb @@ -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. # |