Sha256: c93d46d3042306bad60cd1437e43770bc6ec4f89ba120a3224b46db73e08bad7

Contents?: true

Size: 303 Bytes

Versions: 4

Compression:

Stored size: 303 Bytes

Contents

require 'xlsxwriter'

module WithXlsxFile
  def with_xlsx_file(file_path = 'tmp/test.xlsx', **opts)
    after = opts.delete :after
    XlsxWriter::Workbook.open(file_path, opts) do |wb|
      yield wb
    end
    after.call if after
  ensure
    File.delete file_path if File.exist? file_path
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
xlsxwriter-0.2.1.pre.2 test/support/with_xlsx_file.rb
xlsxwriter-0.2.1.pre test/support/with_xlsx_file.rb
xlsxwriter-0.2.0 test/support/with_xlsx_file.rb
xlsxwriter-0.2.0.pre.2 test/support/with_xlsx_file.rb