mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
updating API docstring so that user can infer default value
This commit is contained in:
@@ -192,13 +192,13 @@ class Date
|
||||
alias :sunday :end_of_week
|
||||
alias :at_end_of_week :end_of_week
|
||||
|
||||
# Returns a new Date/DateTime representing the start of the given day in the previous week (default is Monday).
|
||||
# Returns a new Date/DateTime representing the start of the given day in the previous week (default is :monday).
|
||||
def prev_week(day = :monday)
|
||||
result = (self - 7).beginning_of_week + DAYS_INTO_WEEK[day]
|
||||
self.acts_like?(:time) ? result.change(:hour => 0) : result
|
||||
end
|
||||
|
||||
# Returns a new Date/DateTime representing the start of the given day in next week (default is Monday).
|
||||
# Returns a new Date/DateTime representing the start of the given day in next week (default is :monday).
|
||||
def next_week(day = :monday)
|
||||
result = (self + 7).beginning_of_week + DAYS_INTO_WEEK[day]
|
||||
self.acts_like?(:time) ? result.change(:hour => 0) : result
|
||||
|
||||
@@ -176,12 +176,12 @@ class Time
|
||||
end
|
||||
alias :at_end_of_week :end_of_week
|
||||
|
||||
# Returns a new Time representing the start of the given day in the previous week (default is Monday).
|
||||
# Returns a new Time representing the start of the given day in the previous week (default is :monday).
|
||||
def prev_week(day = :monday)
|
||||
ago(1.week).beginning_of_week.since(DAYS_INTO_WEEK[day].day).change(:hour => 0)
|
||||
end
|
||||
|
||||
# Returns a new Time representing the start of the given day in next week (default is Monday).
|
||||
# Returns a new Time representing the start of the given day in next week (default is :monday).
|
||||
def next_week(day = :monday)
|
||||
since(1.week).beginning_of_week.since(DAYS_INTO_WEEK[day].day).change(:hour => 0)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user