Sha256: e2299d131876591f27b2b2f41a3ae9b1cf3ec521a10f88d6fdeff093e7e07762

Contents?: true

Size: 330 Bytes

Versions: 1

Compression:

Stored size: 330 Bytes

Contents

require 'fastercsv'

class Array
  def to_csv(options = {})    
    if all? { |e| e.respond_to?(:to_row) }
      FasterCSV.generate do |csv|
        csv << first.export_columns(options[:format])
        csv << map { |e| e.to_row(options[:format]) }
      end
    else
      FasterCSV.generate_line(self, options)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
danielvlopes-smart_csv-0.1.0 lib/smart_csv/array.rb