diff options
author | Gilad Zohari <gzohari@gmail.com> | 2013-07-31 13:57:25 +0300 |
---|---|---|
committer | Gilad Zohari <gzohari@gmail.com> | 2013-07-31 13:57:25 +0300 |
commit | 89060b8ef9b56e69e5f28754b5b633f6c8b8c909 (patch) | |
tree | cd0f9917e23e0d811c53b7afce58217aee0c1535 | |
parent | ffb680e121b1868c184381882b083290db230d78 (diff) | |
download | rails-89060b8ef9b56e69e5f28754b5b633f6c8b8c909.tar.gz rails-89060b8ef9b56e69e5f28754b5b633f6c8b8c909.tar.bz2 rails-89060b8ef9b56e69e5f28754b5b633f6c8b8c909.zip |
Remove duplication from date_time calculations
Methods: :past? and :future? are already defined identically
in date_and_time/calculations.rb which is included in Date.
Because DateTime is a subclass of Date, it can call them.
-rw-r--r-- | activesupport/lib/active_support/core_ext/date_time/calculations.rb | 10 |
1 files changed, 0 insertions, 10 deletions
diff --git a/activesupport/lib/active_support/core_ext/date_time/calculations.rb b/activesupport/lib/active_support/core_ext/date_time/calculations.rb index c288a1f9bd..8e5d723074 100644 --- a/activesupport/lib/active_support/core_ext/date_time/calculations.rb +++ b/activesupport/lib/active_support/core_ext/date_time/calculations.rb @@ -10,16 +10,6 @@ class DateTime end end - # Tells whether the DateTime object's datetime lies in the past. - def past? - self < ::DateTime.current - end - - # Tells whether the DateTime object's datetime lies in the future. - def future? - self > ::DateTime.current - end - # Seconds since midnight: DateTime.now.seconds_since_midnight. def seconds_since_midnight sec + (min * 60) + (hour * 3600) |