提交 7a33a005 编写于 作者: G gregolsen 提交者: Xavier Noria

API docstrings updated with default value info

上级 3f1a4c34
......@@ -174,7 +174,7 @@ def next_month
months_since(1)
end unless method_defined?(:next_month)
# Returns number of days to start of this week, week starts on start_day (default is Monday)
# Returns number of days to start of this week, week starts on start_day (default is :monday).
def days_to_week_start(start_day = :monday)
start_day_number = DAYS_INTO_WEEK[start_day]
current_day_number = wday != 0 ? wday - 1 : 6
......@@ -182,7 +182,7 @@ def days_to_week_start(start_day = :monday)
days_span >= 0 ? days_span : 7 + days_span
end
# Returns a new Date/DateTime representing the "start" of this week, week starts on start_day (i.e, Monday; DateTime objects will have time set to 0:00).
# Returns a new Date/DateTime representing the "start" of this week, week starts on start_day (default is :monday, i.e. Monday; DateTime objects will have time set to 0:00).
def beginning_of_week(start_day = :monday)
days_to_start = days_to_week_start(start_day)
result = self - days_to_start
......@@ -191,7 +191,7 @@ def beginning_of_week(start_day = :monday)
alias :monday :beginning_of_week
alias :at_beginning_of_week :beginning_of_week
# Returns a new Date/DateTime representing the end of this week, week starts on start_day (Sunday, DateTime objects will have time set to 23:59:59).
# Returns a new Date/DateTime representing the end of this week, week starts on start_day (default is :monday, i.e. Sunday, DateTime objects will have time set to 23:59:59).
def end_of_week(start_day = :monday)
days_to_end = 6 - days_to_week_start(start_day)
result = self + days_to_end.days
......
......@@ -161,7 +161,7 @@ def next_month
months_since(1)
end
# Returns number of days to start of this week, week starts on start_day (default is Monday)
# Returns number of days to start of this week, week starts on start_day (default is :monday).
def days_to_week_start(start_day = :monday)
start_day_number = DAYS_INTO_WEEK[start_day]
current_day_number = wday != 0 ? wday - 1 : 6
......@@ -169,7 +169,7 @@ def days_to_week_start(start_day = :monday)
days_span >= 0 ? days_span : 7 + days_span
end
# Returns a new Time representing the "start" of this week, week starts on start_day (deafult is Monday, e.g. Monday, 0:00)
# Returns a new Time representing the "start" of this week, week starts on start_day (default is :monday, i.e. Monday, 0:00).
def beginning_of_week(start_day = :monday)
days_to_start = days_to_week_start(start_day)
(self - days_to_start.days).midnight
......@@ -177,7 +177,7 @@ def beginning_of_week(start_day = :monday)
alias :monday :beginning_of_week
alias :at_beginning_of_week :beginning_of_week
# Returns a new Time representing the end of this week, week starts on start_day (deafult is Monday, end of Sunday)
# Returns a new Time representing the end of this week, week starts on start_day (default is :monday, i.e. end of Sunday).
def end_of_week(start_day = :monday)
days_to_end = 6 - days_to_week_start(start_day)
(self + days_to_end.days).end_of_day
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册