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

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

Instance Method Summary collapse

Instance Method Details

#to_csv(*args, **kwargs) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/pincushion/plugins/csv_serializer.rb', line 7

def to_csv(*args, **kwargs)
  rows = all_identifiers_predicates_rows
  kwargs[:headers] ||= [:identifier, :predicate, :value]

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