Sha256: 0bd8f4b1d44b3b72b95abe30236472e981fd30146d3ab3360fe33a637510d93a

Contents?: true

Size: 678 Bytes

Versions: 1

Compression:

Stored size: 678 Bytes

Contents

module DiningTable
  
  module Presenters

    class CSVPresenter < SpreadsheetPresenter
      
      def initialize( *args )
        super
        self.output = ''
      end
      
      def identifier
        :csv
      end
      
      def output
        stringio.string
      end
      
      private
      
        attr_writer :output
        attr_accessor :stringio
        
        def csv
          @csv ||= begin
            self.stringio = StringIO.new
            csv_options = options[:csv] || { }
            CSV.new(stringio, csv_options)
          end
        end
        
        def add_row(array)
          csv.add_row( array )
        end

    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dining-table-0.1.0 lib/dining-table/presenters/csv_presenter.rb