Sha256: c7df7fb3cb6421b743796aecc4aed476756851f2fbca27eb2c13f61ad9fdc4ba

Contents?: true

Size: 628 Bytes

Versions: 1

Compression:

Stored size: 628 Bytes

Contents

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

module ESV
  def self.generate
    generator = Generator.new
    yield(generator)
    generator.render
  end

  def self.parse(data)
    fake_file = StringIO.new(data)
    book = Spreadsheet.open(fake_file)

    # We could support multiple worksheets, but let's not until we actually need it.
    # Until then, we prefer raising to silently ignoring worksheets.
    worksheet_count = book.worksheets.length
    raise "Expected 1 worksheet, found #{worksheet_count}." if worksheet_count > 1

    book.worksheet(0).to_a
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
excel-esv-0.0.4 lib/esv.rb