Module: Pincushion::Plugins::CsvSerializer::RootModuleMethods

Defined in:
lib/pincushion/plugins/csv_serializer.rb

Instance Method Summary collapse

Instance Method Details

#to_csv(*args) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/pincushion/plugins/csv_serializer.rb', line 25

def to_csv(*args)
  args << {} unless args.last.is_a?(Hash)
  args.last[:headers] ||= [:identifier, *predicates]

  CSV.generate(*args) do |csv|
    rows.each { |row| csv << row }
  end
end