Sha256: 956ba50101b0d2e13eeb5a93291f5597fa276012d382c8447afb553486196236

Contents?: true

Size: 453 Bytes

Versions: 1

Compression:

Stored size: 453 Bytes

Contents

# convert input to clean standard CSV
require "csv"

class Masticate::Csvify
  attr_reader :file

  def initialize(file)
    @file = file
  end

  def csvify(opts)
    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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
masticate-0.0.3 lib/masticate/csvify.rb