Sha256: 9ef50d3e79a418437b056db50020898ec90212e8bb2d57d04160d841bb135201

Contents?: true

Size: 563 Bytes

Versions: 2

Compression:

Stored size: 563 Bytes

Contents

require "esv/version"
require "esv/rails_controller"
require "spreadsheet"

class ESV
  def self.generate
    instance = new
    yield(instance)
    instance.render
  end

  def initialize
    @data_rows = []
  end

  def <<(row)
    @data_rows << row
  end

  def render
    book = Spreadsheet::Workbook.new
    sheet = book.create_worksheet

    @data_rows.each_with_index do |data_row, index|
      row = sheet.row(index)
      row.push(*data_row)
    end

    content = ""
    fake_file = StringIO.new(content)
    book.write(fake_file)
    content
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
excel-esv-0.0.2 lib/esv.rb
excel-esv-0.0.1 lib/esv.rb