diff options
author | Rizwan Reza <rizwanreza@gmail.com> | 2010-05-17 02:40:15 +0430 |
---|---|---|
committer | Rizwan Reza <rizwanreza@gmail.com> | 2010-05-17 02:40:15 +0430 |
commit | d148a6f6ba5f8ee65905f12cd2601fcc377d4852 (patch) | |
tree | 4bcb5e7ad47cfb9a9bb14ffe7c9e003d4646d64c /activesupport/lib/active_support/core_ext/date | |
parent | e1c773006969abea3c0619fbdc7e32c121b6085f (diff) | |
parent | 6b4e0cc526f55b5532cf99292c94f0a4db53b16f (diff) | |
download | rails-d148a6f6ba5f8ee65905f12cd2601fcc377d4852.tar.gz rails-d148a6f6ba5f8ee65905f12cd2601fcc377d4852.tar.bz2 rails-d148a6f6ba5f8ee65905f12cd2601fcc377d4852.zip |
Merge branch 'master' of git://github.com/rails/rails
Diffstat (limited to 'activesupport/lib/active_support/core_ext/date')
-rw-r--r-- | activesupport/lib/active_support/core_ext/date/calculations.rb | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/activesupport/lib/active_support/core_ext/date/calculations.rb b/activesupport/lib/active_support/core_ext/date/calculations.rb index 3038729d34..755d96ce91 100644 --- a/activesupport/lib/active_support/core_ext/date/calculations.rb +++ b/activesupport/lib/active_support/core_ext/date/calculations.rb @@ -2,6 +2,7 @@ require 'date' require 'active_support/duration' require 'active_support/core_ext/time/zones' require 'active_support/core_ext/object/acts_like' +require 'active_support/deprecation' class Date if RUBY_VERSION < '1.9' @@ -146,20 +147,30 @@ class Date advance(:years => years) end - # Short-hand for years_ago(1) - def last_year - years_ago(1) + def last_year # :nodoc: + ActiveSupport::Deprecation.warn("Date#last_year has been deprecated, please use Date#prev_year instead", caller) + prev_year end + # Shorthand for years_ago(1) + def prev_year + years_ago(1) + end unless method_defined?(:prev_year) + # Short-hand for years_since(1) def next_year years_since(1) end unless method_defined?(:next_year) + def last_month # :nodoc: + ActiveSupport::Deprecation.warn("Date#last_month has been deprecated, please use Date#prev_month instead", caller) + prev_month + end + # Short-hand for months_ago(1) - def last_month + def prev_month months_ago(1) - end + end unless method_defined?(:prev_month) # Short-hand for months_since(1) def next_month |