to_sentence
- 1.0.0
- 1.1.0
- 1.1.1
- 1.1.6
- 1.2.0
- 1.2.6
- 2.0.0
- 2.0.1
- 2.0.3
- 2.1.0
- 2.2.1
- 2.3.2
- 2.3.8
- 3.0.0 (0)
- 3.0.5 (0)
- 3.0.7 (0)
- 3.0.9 (-38)
- 3.1.0 (0)
- 3.2.1 (0)
- 3.2.3 (0)
- 3.2.8 (0)
- 3.2.13 (0)
- What's this?
to_sentence(options = {})
public
Converts the array to a comma-separated sentence where the last element is joined by the connector word. Options:
-
:words_connector - The sign or word used to join the elements in arrays with two or more elements (default: “, ”)
-
:two_words_connector - The sign or word used to join the elements in arrays with two elements (default: “ and ”)
-
:last_word_connector - The sign or word used to join the last element in arrays with three or more elements (default: “, and ”)
example
[‘one’,‘two’,‘three’].to_sentence # => “one, two, and three”


