method

to_csv

Importance_1
to_csv(**options) public

Equivalent to CSV::generate_line(self, options)

["CSV", "data"].to_csv
  #=> "CSV,data\n"
Show source
Register or log in to add new notes.
April 29, 2015
0 thanks

Prevent new line character.

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

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

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