class CsvComposer::Base

Public Instance Methods

compose(items, opts = {}) click to toggle source
# File lib/csv_composer/base.rb, line 4
def compose(items, opts = {})
  content = separator_metadata
  content += write(items, opts)

  export(content, opts)
end

Private Instance Methods

columns_mapping() click to toggle source
# File lib/csv_composer/base.rb, line 22
def columns_mapping
  # Create a mapping for each column in the export CSV
end
export(content, opts = {}) click to toggle source
# File lib/csv_composer/base.rb, line 31
def export(content, opts = {})
  exporter.new.export(content, opts)
end
exporter() click to toggle source
# File lib/csv_composer/base.rb, line 19
def exporter
end
header_processor() click to toggle source
# File lib/csv_composer/base.rb, line 13
def header_processor
end
item_processor() click to toggle source
# File lib/csv_composer/base.rb, line 16
def item_processor
end
separator_metadata() click to toggle source
# File lib/csv_composer/base.rb, line 35
def separator_metadata
  "sep=,\n"
end
write(collection, writing_options = {}) click to toggle source
# File lib/csv_composer/base.rb, line 26
def write(collection, writing_options = {})
  writer = Writer.new
  writer.write(header_processor.new, item_processor.new, collection, columns_mapping, writing_options)
end