lib/masticate/csvify.rb in masticate-0.0.2 vs lib/masticate/csvify.rb in masticate-0.0.3

- old
+ new

@@ -7,10 +7,14 @@ def initialize(file) @file = file end def csvify(opts) - CSV.foreach(file, :col_sep => opts[:col_sep]) do |row| + csv_options = {} + csv_options[:col_sep] = opts[:col_sep] if opts[:col_sep] + csv_options[:quote_char] = opts[:quote_char] || opts[:col_sep] if opts[:quote_char] || opts[:col_sep] + + CSV.foreach(file, csv_options) do |row| opts[:output] << row.to_csv end end end