Note: Don't use this class directly. This is an internal class.
A CSV::Writer receives an output, prepares the header, format and output. It allows us to write new rows in the object and rewind it.
Adds a new row
# File csv/writer.rb, line 33
def <<(row)
case row
when Row
row = row.fields
when Hash
row = @headers.collect {|header| row[header]}
end
@headers ||= row if @use_headers
@lineno += 1
row = @fields_converter.convert(row, nil, lineno) if @fields_converter
i = -1
converted_row = row.collect do |field|
i += 1
quote(field, i)
end
line = converted_row.join(@column_separator) + @row_separator
if @output_encoding
line = line.encode(@output_encoding)
end
@output << line
self
end