Permalink
Browse files

removes deprecations of last_(month|year) from master, they will be d…

…eprecated in 2.3 instead
  • Loading branch information...
1 parent 223d641 commit b753b4a076d7067efccbd1ad384829f77e62a064 @fxn fxn committed May 18, 2010
@@ -2,7 +2,7 @@
* Renames Array#rand -> Array#random_element. [Santiago Pastorino, Rizwan Reza]
-* Defines prev_(month|year) in Date and Time, and deprecates last_(month|year). [fxn]
+* 1.9 compat: Renames last_(month|year) to prev_(month|year) in Date and Time. [fxn]
* Aliases Date#sunday to Date#end_of_week. [fxn]
@@ -2,7 +2,6 @@
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'
@@ -147,11 +146,6 @@ def years_since(years)
advance(:years => years)
end
- 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)
@@ -161,11 +155,6 @@ def prev_year
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 prev_month
@@ -2,7 +2,6 @@
require 'active_support/core_ext/date/acts_like'
require 'active_support/core_ext/date/calculations'
require 'active_support/core_ext/date_time/conversions'
-require 'active_support/deprecation'
class Time
COMMON_YEAR_DAYS_IN_MONTH = [nil, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
@@ -133,11 +132,6 @@ def years_since(years)
advance(:years => years)
end
- def last_year # :nodoc:
- ActiveSupport::Deprecation.warn("Time#last_year has been deprecated, please use Time#prev_year instead", caller)
- prev_year
- end
-
# Short-hand for years_ago(1)
def prev_year
years_ago(1)
@@ -148,11 +142,6 @@ def next_year
years_since(1)
end
- def last_month # :nodoc:
- ActiveSupport::Deprecation.warn("Time#last_month has been deprecated, please use Time#prev_month instead", caller)
- prev_month
- end
-
# Short-hand for months_ago(1)
def prev_month
months_ago(1)
@@ -145,10 +145,6 @@ def test_years_since
assert_equal Date.new(2005,2,28), Date.new(2004,2,29).years_since(1) # 1 year since leap day
end
- def test_last_year_is_deprecated
- assert_deprecated { Date.today.last_year }
- end
-
def test_prev_year
assert_equal Date.new(2004,6,5), Date.new(2005,6,5).prev_year
end
@@ -229,10 +225,6 @@ def test_next_month_on_31st
assert_equal Date.new(2005, 9, 30), Date.new(2005, 8, 31).next_month
end
- def test_last_month_is_deprecated
- assert_deprecated { Date.today.last_month }
- end
-
def test_prev_month_on_31st
assert_equal Date.new(2004, 2, 29), Date.new(2004, 3, 31).prev_month
end
@@ -166,10 +166,6 @@ def test_years_since
# assert_equal Time.local(2182,6,5,10), Time.local(2005,6,5,10,0,0).years_since(177)
end
- def test_last_year_is_deprecated
- assert_deprecated { Time.now.last_year }
- end
-
def test_prev_year
assert_equal Time.local(2004,6,5,10), Time.local(2005,6,5,10,0,0).prev_year
end
@@ -619,10 +615,6 @@ def test_next_month_on_31st
assert_equal Time.local(2005, 9, 30), Time.local(2005, 8, 31).next_month
end
- def test_last_month_is_deprecated
- assert_deprecated { Time.now.last_month }
- end
-
def test_prev_month_on_31st
assert_equal Time.local(2004, 2, 29), Time.local(2004, 3, 31).prev_month
end

0 comments on commit b753b4a

Please sign in to comment.