From 7c1566b2789c779acfeba34a7d86ab5ca5e2c0bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Mon, 14 Nov 2016 13:16:00 -0500 Subject: Revert "Merge pull request #25811 from oss92/to_sentence_fallback_string" This reverts commit bad3a120f1690f393d8f6204b3ceee60f0ce707b, reversing changes made to 2384317465ccb1dfca456a2b7798714b99f32711. Reason: Adding a new option in the API for something that can be done with a `#presence` check could do. --- activesupport/lib/active_support/core_ext/array/conversions.rb | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'activesupport/lib/active_support') diff --git a/activesupport/lib/active_support/core_ext/array/conversions.rb b/activesupport/lib/active_support/core_ext/array/conversions.rb index 1d4c83ae52..cac15e1100 100644 --- a/activesupport/lib/active_support/core_ext/array/conversions.rb +++ b/activesupport/lib/active_support/core_ext/array/conversions.rb @@ -40,12 +40,6 @@ class Array # ['one', 'two', 'three'].to_sentence(words_connector: ' or ', last_word_connector: ' or at least ') # # => "one or two or at least three" # - # [].to_sentence(fallback_string: 'none') - # # => "none" - # - # ['one', 'two'].to_sentence(fallback_string: 'none') - # # => "one and two" - # # Using :locale option: # # # Given this locale dictionary: @@ -63,7 +57,7 @@ class Array # ['uno', 'dos', 'tres'].to_sentence(locale: :es) # # => "uno o dos o al menos tres" def to_sentence(options = {}) - options.assert_valid_keys(:words_connector, :two_words_connector, :last_word_connector, :locale, :fallback_string) + options.assert_valid_keys(:words_connector, :two_words_connector, :last_word_connector, :locale) default_connectors = { words_connector: ", ", @@ -78,7 +72,7 @@ class Array case length when 0 - "#{options[:fallback_string] || ''}" + "" when 1 "#{self[0]}" when 2 -- cgit v1.2.3