class DiningTable::Presenters::CSVPresenter

Attributes

output[W]
stringio[RW]

Public Class Methods

new( *args ) click to toggle source
Calls superclass method
# File lib/dining-table/presenters/csv_presenter.rb, line 13
def initialize( *args )
  super
  self.output = ''
end

Public Instance Methods

identifier() click to toggle source
# File lib/dining-table/presenters/csv_presenter.rb, line 18
def identifier
  :csv
end
output() click to toggle source
# File lib/dining-table/presenters/csv_presenter.rb, line 22
def output
  stringio.string
end

Private Instance Methods

add_row(array) click to toggle source
# File lib/dining-table/presenters/csv_presenter.rb, line 36
def add_row(array)
  csv.add_row( array )
end
csv() click to toggle source
# File lib/dining-table/presenters/csv_presenter.rb, line 28
def csv
  @csv ||= begin
    self.stringio = StringIO.new
    csv_options = options[:csv] || { }
    CSV.new(stringio, **csv_options)
  end
end