Class: ExportTo::Exporter::Csv

Inherits:
Struct
  • Object
show all
Defined in:
lib/export_to/exporter/csv.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#rowsObject

Returns the value of attribute rows

Returns:

  • (Object)

    the current value of rows



3
4
5
# File 'lib/export_to/exporter/csv.rb', line 3

def rows
  @rows
end

Instance Method Details

#exportObject



5
6
7
8
9
10
11
# File 'lib/export_to/exporter/csv.rb', line 5

def export
  CSV.generate(force_quotes: true) do |csv|
    rows.each! do |columns, model, x|
      csv << columns
    end
  end
end