End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
CSV::Table#to_s
to_s(write_headers: true, **options)
lib/csv/table.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.0.5/lib/csv/table.rb, line 588
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
array.join("")
end
Alias of #to_csv
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.