lib/remarkable/messages.rb in remarkable-3.1.3 vs lib/remarkable/messages.rb in remarkable-3.1.4
- old
+ new
@@ -78,26 +78,26 @@
Remarkable.t('remarkable.core.not', :default => 'not') + " "
end
# Converts an array to a sentence
#
- def array_to_sentence(array, inspect=false)
+ def array_to_sentence(array, inspect=false, empty_default='')
words_connector = Remarkable.t 'remarkable.core.helpers.words_connector'
two_words_connector = Remarkable.t 'remarkable.core.helpers.two_words_connector'
last_word_connector = Remarkable.t 'remarkable.core.helpers.last_word_connector'
array.map!{|i| i.inspect} if inspect
case array.length
when 0
- ''
+ empty_default
when 1
array[0].to_s
when 2
"#{array[0]}#{two_words_connector}#{array[1]}"
else
"#{array[0...-1].join(words_connector)}#{last_word_connector}#{array[-1]}"
end
- end
+ end
end
end