summaryrefslogtreecommitdiff
path: root/lib/csv/writer.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/csv/writer.rb')
-rw-r--r--lib/csv/writer.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/csv/writer.rb b/lib/csv/writer.rb
index 36db9d4014..8e0aab32ff 100644
--- a/lib/csv/writer.rb
+++ b/lib/csv/writer.rb
@@ -18,6 +18,7 @@ class CSV
if @options[:write_headers] and @headers
self << @headers
end
+ @fields_converter = @options[:fields_converter]
end
def <<(row)
@@ -31,6 +32,8 @@ class CSV
@headers ||= row if @use_headers
@lineno += 1
+ row = @fields_converter.convert(row, nil, lineno) if @fields_converter
+
converted_row = row.collect do |field|
quote(field)
end