aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/date_and_time/compatibility.rb
Commit message (Collapse)AuthorAgeFilesLines
* [Active Support] require_relative => requireAkira Matsuda2017-10-211-1/+1
| | | | This basically reverts 8da30ad6be34339124ba4cb4e36aea260dda12bc
* [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment`Koichi ITO2017-07-111-0/+1
|
* Use frozen-string-literal in ActiveSupportKir Shatrov2017-07-091-0/+1
|
* [Active Support] require => require_relativeAkira Matsuda2017-07-011-1/+1
|
* Use mattr_accessor default: option throughout the projectGenadi Samokovarov2017-06-031-1/+1
|
* Move `to_time` to `DateTime` compatibility.rb fileAndrew White2017-03-161-4/+0
| | | | | | We are overriding it in `Time` and `ActiveSupport::TimeWithZone` so there's no point in having it in the `DateAndTime::Compatibility` module. Also add some docs for the `to_time` implementations.
* Handle #to_time and memoization taking into account memoization, frozen ↵Kevin McPhillips2017-03-061-5/+1
| | | | state, and preserve_timezone flag.
* Cache to_time to improve performance when comparingAndrew White2016-10-021-1/+5
| | | | | | | | | | | | | | | | In #25880 we tried to cache localtime to fix the performance regression but that proved to be difficult due to the fact that localtime/getlocal can take a utc_offset argument. We tried caching based on the argument but since the argument can be nil sometimes that meant that if the TZ environment variable changed then the cached value for nil became invalid. By moving the caching to DateAndTime#compatibility we don't have to worry about arguments since it doesn't take any. There is a possible edge condition where preserve_timezone is set to false and the system timezone changes then it could result in a cached value being incorrect but the only way to fix this would be to remove all caching and live with the performance issue.
* applies new string literal convention in activesupport/libXavier Noria2016-08-061-1/+1
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Add require of mattr_accessor since Compatibility relies on it.Jason Frey2016-04-251-0/+2
| | | | | Follow up to https://github.com/rails/rails/commit/c9c5788a527b70d7f983e2b4b47e3afd863d9f48
* Follow up of ↵Vipul A M2016-04-241-4/+4
| | | | | | https://github.com/rails/rails/commit/c9c5788a527b70d7f983e2b4b47e3afd863d9f48 [ci skip]
* Add compatibility for Ruby 2.4 `to_time` changesAndrew White2016-04-231-0/+16
In Ruby 2.4 the `to_time` method for both `DateTime` and `Time` will preserve the timezone of the receiver when converting to an instance of `Time`. Since Rails 5.0 will support Ruby 2.2, 2.3 and later we need to introduce a compatibility layer so that apps that upgrade do not break. New apps will have a config initializer file that defaults to match the new Ruby 2.4 behavior going forward. For information about the changes to Ruby see: https://bugs.ruby-lang.org/issues/12189 https://bugs.ruby-lang.org/issues/12271 Fixes #24617.