Sha256: 5b651dad52b8df7cbe702e4473c16620a08fb0fbaddf8a1457a27f0f3107e249

Contents?: true

Size: 506 Bytes

Versions: 7

Compression:

Stored size: 506 Bytes

Contents

require 'csv'

module SpreadsheetArchitect
  module ClassMethods

    def to_csv(opts={})
      opts = SpreadsheetArchitect::Utils.get_options(opts, self)
      options = SpreadsheetArchitect::Utils.get_cell_data(opts, self)

      CSV.generate do |csv|
        if options[:headers]
          options[:headers].each do |header_row|
            csv << header_row
          end
        end
        
        options[:data].each do |row_data|
          csv << row_data
        end
      end
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
spreadsheet_architect-5.0.1 lib/spreadsheet_architect/class_methods/csv.rb
spreadsheet_architect-5.0.0 lib/spreadsheet_architect/class_methods/csv.rb
spreadsheet_architect-4.2.0 lib/spreadsheet_architect/class_methods/csv.rb
spreadsheet_architect-4.1.0 lib/spreadsheet_architect/class_methods/csv.rb
spreadsheet_architect-4.0.1 lib/spreadsheet_architect/class_methods/csv.rb
spreadsheet_architect-4.0.0 lib/spreadsheet_architect/class_methods/csv.rb
spreadsheet_architect-3.3.1 lib/spreadsheet_architect/class_methods/csv.rb