Sha256: bbfb9114d52814d2945e8e781347bcf43c3ac15a6d0fa8eff5f1ce4bbf287024

Contents?: true

Size: 348 Bytes

Versions: 1

Compression:

Stored size: 348 Bytes

Contents

# frozen_string_literal: true

require 'xlsxwriter'

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
xlsxwriter-0.2.2 test/support/with_xlsx_file.rb