From 8b4729a0eb2020cc5f7ed93951e97335bd3d2700 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20L=C3=BCtke?= Date: Wed, 8 Mar 2006 16:13:13 +0000 Subject: reverted #to_sentence to use red, green, and blue style git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3816 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activesupport/lib/active_support/core_ext/array/conversions.rb | 4 ++-- activesupport/test/core_ext/array_ext_test.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/activesupport/lib/active_support/core_ext/array/conversions.rb b/activesupport/lib/active_support/core_ext/array/conversions.rb index 50777f9e1e..faa995bc9c 100644 --- a/activesupport/lib/active_support/core_ext/array/conversions.rb +++ b/activesupport/lib/active_support/core_ext/array/conversions.rb @@ -4,10 +4,10 @@ module ActiveSupport #:nodoc: module Conversions # Converts the array to comma-seperated sentence where the last element is joined by the connector word. Options: # * :connector: The word used to join the last element in arrays with more than two elements (default: "and") - # * :skip_last_comma: Set to false to return "a, b, and c" instead of "a, b and c". + # * :skip_last_comma: 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 => true + options.reverse_merge! :connector => 'and', :skip_last_comma => false case length when 0 diff --git a/activesupport/test/core_ext/array_ext_test.rb b/activesupport/test/core_ext/array_ext_test.rb index e13c57d262..956c10665d 100644 --- a/activesupport/test/core_ext/array_ext_test.rb +++ b/activesupport/test/core_ext/array_ext_test.rb @@ -18,12 +18,12 @@ class ArrayExtConversionTests < Test::Unit::TestCase assert_equal "", [].to_sentence assert_equal "one", ['one'].to_sentence assert_equal "one and two", ['one', 'two'].to_sentence - assert_equal "one, two and three", ['one', 'two', 'three'].to_sentence + assert_equal "one, two, and three", ['one', 'two', 'three'].to_sentence end def test_to_sentence_with_connector - assert_equal "one, two and also three", ['one', 'two', 'three'].to_sentence(:connector => 'and also') + assert_equal "one, two, and also three", ['one', 'two', 'three'].to_sentence(:connector => 'and also') end def test_to_sentence_with_skip_last_comma -- cgit v1.2.3