Sha256: 01750b4f9e9847e4ac5935da0300d27f681d425d3cf7479f74a391c1c3d72a14

Contents?: true

Size: 601 Bytes

Versions: 1

Compression:

Stored size: 601 Bytes

Contents

require 'fastercsv'
module TableGo
  module Renderers
    class CsvRenderer
      include RendererBase

      def render_template
        ::FasterCSV.generate(:col_sep => ";", :row_sep => "\n", :force_quotes => true, :quote_char => '"') do |csv|
          csv << table.columns.map { |column| label_for_column(column) }
          table.collection.each do |record|
            csv << table.columns.map do |column|
              value = value_from_record_by_column(record, column)
              apply_formatter(record, column, value)
            end
          end
        end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
table_go-0.2.3 lib/table_go/renderers/csv_renderer.rb