Sha256: d458fb8e9e8f19f22f0dec0d87e376f5683d90f7b2521b8cf21ea69c11717ef0
Contents?: true
Size: 418 Bytes
Versions: 1
Compression:
Stored size: 418 Bytes
Contents
module Exporter class CsvExporter < Exporter def process(data, options) raise TypeError.new unless is_active_record?(data, options) columns = options[:columns] || data[0].class.attribute_names data = CSV.generate do |csv| csv << columns data.each do |d| csv << d.attributes.values_at(*columns) end end CsvDocument.new(data) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
exporter-0.1.0 | lib/exporter/exporters/csv_exporter.rb |