Skip to content

Commit

Permalink
Merge pull request #3668 from gregolsen/api_docstring_fix
Browse files Browse the repository at this point in the history
updating API docstring so that user can infer default value
  • Loading branch information
spastorino committed Nov 19, 2011
2 parents 43158e5 + 8d83e33 commit 4cdd44e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,13 @@ def end_of_week
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,12 @@ def end_of_week
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
Expand Down

0 comments on commit 4cdd44e

Please sign in to comment.