From d6366625e04c516bf5f4bd6f561c3bb1945b0c82 Mon Sep 17 00:00:00 2001 From: Matt Bridges Date: Tue, 3 Jan 2012 19:53:13 -0600 Subject: Adding :last_week, :last_month, and :last_year aliases to Time and Date core extensions --- .../source/active_support_core_extensions.textile | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'railties/guides/source/active_support_core_extensions.textile') diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile index 1c82a2941f..3983667c2b 100644 --- a/railties/guides/source/active_support_core_extensions.textile +++ b/railties/guides/source/active_support_core_extensions.textile @@ -2858,6 +2858,8 @@ d.next_year # => Wed, 28 Feb 2001 Active Support defines these methods as well for Ruby 1.8. ++prev_year+ is aliased to +last_year+. + h6. +prev_month+, +next_month+ In Ruby 1.9 +prev_month+ and +next_month+ return the date with the same day in the last or next month: @@ -2879,6 +2881,8 @@ Date.new(2000, 1, 31).next_month # => Tue, 29 Feb 2000 Active Support defines these methods as well for Ruby 1.8. ++prev_month+ is aliased to +last_month+. + h6. +beginning_of_week+, +end_of_week+ The methods +beginning_of_week+ and +end_of_week+ return the dates for the @@ -2924,6 +2928,8 @@ d.prev_week(:saturday) # => Sat, 01 May 2010 d.prev_week(:friday) # => Fri, 30 Apr 2010 ++prev_week+ is aliased to +last_week+. + h6. +beginning_of_month+, +end_of_month+ The methods +beginning_of_month+ and +end_of_month+ return the dates for the beginning and end of the month: @@ -3134,13 +3140,13 @@ end_of_week (at_end_of_week) monday sunday weeks_ago -prev_week +prev_week (last_week) next_week months_ago months_since beginning_of_month (at_beginning_of_month) end_of_month (at_end_of_month) -prev_month +prev_month (last_month) next_month beginning_of_quarter (at_beginning_of_quarter) end_of_quarter (at_end_of_quarter) @@ -3148,7 +3154,7 @@ beginning_of_year (at_beginning_of_year) end_of_year (at_end_of_year) years_ago years_since -prev_year +prev_year (last_year) next_year @@ -3310,13 +3316,13 @@ end_of_week (at_end_of_week) monday sunday weeks_ago -prev_week +prev_week (last_week) next_week months_ago months_since beginning_of_month (at_beginning_of_month) end_of_month (at_end_of_month) -prev_month +prev_month (last_month) next_month beginning_of_quarter (at_beginning_of_quarter) end_of_quarter (at_end_of_quarter) @@ -3324,7 +3330,7 @@ beginning_of_year (at_beginning_of_year) end_of_year (at_end_of_year) years_ago years_since -prev_year +prev_year (last_year) next_year -- cgit v1.2.3