method

to_csv

v1_9_3_392 - Show latest stable - Class: Array
to_csv(options = Hash.new)
public

Equivalent to CSV::generate_line(self, options).

1Note

Prevent new line character.

joshuapinter ยท Apr 29, 2015

To prevent the "\
" character added at the end of each file pass in the "row_sep: nil" option:

[ "some", "array" ].to_csv                 # => "some, array\

"

[ "some", "array" ].to_csv( row_sep: nil ) # => "some, array"