instance method
next_week
Ruby on Rails 2.3.18
Since v2.2.3 Last seen in v2.3.18Available in: v2.2.3 v2.3.18
Signature
next_week(day = :monday)
Returns a new Date/DateTime representing the start of the given day in next week (default is Monday).
Parameters
-
dayopt = :monday
Source
# File activesupport/lib/active_support/core_ext/date/calculations.rb, line 186
def next_week(day = :monday)
days_into_week = { :monday => 0, :tuesday => 1, :wednesday => 2, :thursday => 3, :friday => 4, :saturday => 5, :sunday => 6}
result = (self + 7).beginning_of_week + days_into_week[day]
self.acts_like?(:time) ? result.change(:hour => 0) : result
end
Defined in activesupport/lib/active_support/core_ext/date/calculations.rb line 186
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::CoreExtensions::Date::Calculations