Sha256: e644d310ad28793035433de7f4d3fe891bc1dc63fa60e134bd152a903369a1f8

Contents?: true

Size: 534 Bytes

Versions: 5

Compression:

Stored size: 534 Bytes

Contents

# -*- encoding : utf-8 -*-
require 'csv'

module Workbook
  module Writers
    module CsvTableWriter
      def to_csv options={}
        csv = ""
        options = {}.merge options
        self.each_with_index do |r, ri|
          line=nil
          begin
            line = CSV::generate_line(r.collect{|c| c.value if c},{:row_sep=>""})
          rescue TypeError
            line = CSV::generate_line(r.collect{|c| c.value if c})
          end
          csv += "#{line}\n"
        end
        csv
      end
      
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
workbook-0.4.2 lib/workbook/writers/csv_table_writer.rb
workbook-0.4.1 lib/workbook/writers/csv_table_writer.rb
workbook-0.4 lib/workbook/writers/csv_table_writer.rb
workbook-0.3.1 lib/workbook/writers/csv_table_writer.rb
workbook-0.3.0 lib/workbook/writers/csv_table_writer.rb