require 'csv' module PanicBoardData class Table attr_accessor :data, :widths def to_html result = "" if data data.each do |record| result << "" record.each_with_index do |item, index| if widths && widths[index] result << "" else result << "" end end result << "" end end result << "
#{item}#{item}
" end def self.to_csv data ::CSV.generate do |csv| data.each { |row| csv << row } end.strip end end end