mirror of
https://github.com/github/rails.git
synced 2026-01-29 00:08:15 -05:00
changed default of Array#to_sentence to use one, two and three notation ( skip_last_comma => true )
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3802 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
@@ -5,10 +5,10 @@ module ActiveSupport #: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>:skip_last_comma</tt>: Set to false 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
|
||||
options.reverse_merge! :connector => 'and', :skip_last_comma => true
|
||||
|
||||
case length
|
||||
when 0
|
||||
|
||||
Reference in New Issue
Block a user