instance method
next_week
Ruby on Rails 2.2.3
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 Time representing the start of the given day in next week (default is Monday).
Parameters
-
dayopt = :monday
Source
# File activesupport/lib/active_support/core_ext/time/calculations.rb, line 197
def next_week(day = :monday)
days_into_week = { :monday => 0, :tuesday => 1, :wednesday => 2, :thursday => 3, :friday => 4, :saturday => 5, :sunday => 6}
since(1.week).beginning_of_week.since(days_into_week[day].day).change(:hour => 0)
end
Defined in activesupport/lib/active_support/core_ext/time/calculations.rb line 197
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::CoreExtensions::Time::Calculations