Class: DeclarativeGrid::Renderers::Csv

Inherits:
AbstractRenderer show all
Defined in:
lib/declarative_grid/renderers/csv.rb

Instance Attribute Summary

Attributes inherited from AbstractRenderer

#options, #records

Instance Method Summary collapse

Methods inherited from AbstractRenderer

#columns, #each_record, #each_row, grid_class, grid_class=, #headers, inherited, #initialize, #inspect, options, options=, #to_string

Constructor Details

This class inherits a constructor from DeclarativeGrid::Renderers::AbstractRenderer

Instance Method Details

#perform(io) ⇒ Object



6
7
8
9
10
# File 'lib/declarative_grid/renderers/csv.rb', line 6

def perform(io)
  csv = CSV.new(io, headers: true, write_headers: true)
  csv << self.headers
  self.each_row {|row| csv << row }
end