aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-02-21 15:05:32 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-02-21 15:05:32 +0000
commit6e84d82ce95a09f80f431b6c0a70900f9cb6a3da (patch)
tree4e0e402248ef88c1e542fc1c5edc224298b88c13
parentb08f35309bbec4b309ff614b30ff45f6c7309d40 (diff)
downloadrails-6e84d82ce95a09f80f431b6c0a70900f9cb6a3da.tar.gz
rails-6e84d82ce95a09f80f431b6c0a70900f9cb6a3da.tar.bz2
rails-6e84d82ce95a09f80f431b6c0a70900f9cb6a3da.zip
Make it possible to say Time.now.in(1.year)
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@735 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r--activesupport/lib/active_support/core_ext/time/calculations.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/time/calculations.rb b/activesupport/lib/active_support/core_ext/time/calculations.rb
index 3ebfa125be..6744930756 100644
--- a/activesupport/lib/active_support/core_ext/time/calculations.rb
+++ b/activesupport/lib/active_support/core_ext/time/calculations.rb
@@ -35,6 +35,7 @@ module ActiveSupport #:nodoc:
def since(seconds)
seconds.since(self)
end
+ alias :in :since
# Returns a new Time representing the time a number of specified months ago
def months_ago(months)
@@ -62,7 +63,7 @@ module ActiveSupport #:nodoc:
def next_month
months_since(1)
end
-
+
# Returns a new Time representing the "start" of this week (Monday, 0:00)
def beginning_of_week
(self - self.wday.days).midnight + 1.day