class Reportabull::CsvBuilder

Public Instance Methods

add_byte_order_mark() click to toggle source
# File lib/reportabull/csv_builder.rb, line 8
def add_byte_order_mark
  bom = options.fetch(:byte_order_mark, false)
  output << bom if bom
end
build_header() click to toggle source
# File lib/reportabull/csv_builder.rb, line 13
def build_header
  add_byte_order_mark
  return unless options.fetch(:column_names, true)
  headers = columns.map { |column| encode(column.name, options) }
  output << CSV.generate_line(headers, options)
end
build_rows() click to toggle source
# File lib/reportabull/csv_builder.rb, line 20
def build_rows
  collection.each do |resource|
    row = build_row(resource)
    output << CSV.generate_line(row.values, options)
  end
end