Converts the array to comma-seperated sentence where the last element is joined by the connector word. Options:Usage
- :connector: The word used to join the last element in arrays with two or more elements (default: "and")
- :skip_last_comma: Set to true to return "a, b and c" instead of "a, b, and c".
Array#to_sentence is perfect for joining information stored in an array that needs to be presented in a human readable format (e.g. an array of errors).
test "words are joined nicely" do
expected = "one, two, and three"
assert_equal expected, ['one', 'two', 'three'].to_sentence