Sha256: 149082fd42c7d31b67163bceeb3d72b33e66361904585051b2a41f587370590c
Contents?: true
Size: 497 Bytes
Versions: 4
Compression:
Stored size: 497 Bytes
Contents
# encoding: utf-8 class ReportGenerator def build(report_columns,query) workbook = RubyXL::Workbook.new worksheet = workbook[0] report_columns.each_with_index do |report_column, i| worksheet.add_cell(0, i, report_column.name) end query.all.each_with_index do |element, x| report_columns.each_with_index do |report_column, y| worksheet.add_cell(x+1, y, report_column.value(element)) end end IO.copy_stream(workbook.stream, out) end end
Version data entries
4 entries across 4 versions & 1 rubygems