to_csv(write_headers: true, **options)
public
Returns the table as a complete CSV String. Headers will be listed first, then all of
the field rows.
This method assumes you want the Table.headers(), unless you explicitly
pass :write_headers => false.
# File lib/csv.rb, line 896
def to_csv(write_headers: true, **options)
array = write_headers ? [headers.to_csv(options)] : []
@table.each do |row|
array.push(row.fields.to_csv(options)) unless row.header_row?
end
return array.join('')
end