Sha256: 6beef61fc46c5932c735e77b8e630d7ac3531a0800f2d04495c1234ab957437d
Contents?: true
Size: 773 Bytes
Versions: 3
Compression:
Stored size: 773 Bytes
Contents
class Report class Csv class Table < Struct.new(:parent, :table) include Report::Utils def path return @path if defined?(@path) tmp_path = tmp_path(:hint => table.name, :extname => '.csv') File.open(tmp_path, 'wb') do |f| if table._head table._head.each(parent.report) do |row| f.write row.to_a.to_csv end f.write [].to_csv end if table._body f.write table._body.columns.map(&:name).to_csv table._body.each(parent.report) do |row| f.write row.to_a.to_csv end end end @path = tmp_path end def cleanup safe_delete @path if @path end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
report-0.1.1 | lib/report/csv/table.rb |
report-0.1.0 | lib/report/csv/table.rb |
report-0.0.3 | lib/report/csv/table.rb |