提交 b533431c 编写于 作者: J Jeremy Kemper

Correct and clarify Array#to_sentence docs. Closes #5458.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4485 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 b91e6aa6
*SVN*
* Correct and clarify Array#to_sentence docs. #5458 [brad@madriska.com]
* alias_method_chain preserves method punctuation so foo, foo?, and foo! may be chained with the same feature. [Jeremy Kemper]
Example:
alias_method_chain :save!, :validation
......
......@@ -3,8 +3,8 @@ module CoreExtensions #:nodoc:
module Array #:nodoc:
module Conversions
# Converts the array to comma-seperated sentence where the last element is joined by the connector word. Options:
# * <tt>:connector</tt>: The word used to join the last element in arrays with more than two elements (default: "and")
# * <tt>:skip_last_comma</tt>: Set to true to return "a, b, and c" instead of "a, b and c".
# * <tt>:connector</tt>: The word used to join the last element in arrays with two or more elements (default: "and")
# * <tt>:skip_last_comma</tt>: Set to true to return "a, b and c" instead of "a, b, and c".
def to_sentence(options = {})
options.assert_valid_keys(:connector, :skip_last_comma)
options.reverse_merge! :connector => 'and', :skip_last_comma => false
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册