lib/io_streams/xlsx/reader.rb in iostreams-1.1.0 vs lib/io_streams/xlsx/reader.rb in iostreams-1.1.1

- old
+ new

@@ -1,21 +1,21 @@ -require 'csv' +require "csv" module IOStreams module Xlsx class Reader < IOStreams::Reader # Convert a xlsx, or xlsm file into CSV format. def self.file(file_name, original_file_name: file_name, &block) # Stream into a temp file as csv - Utils.temp_file_name('iostreams_csv') do |temp_file_name| - ::File.open(temp_file_name, 'wb') { |io| new(file_name).each { |lines| io << lines.to_csv } } - ::File.open(temp_file_name, 'rb', &block) + Utils.temp_file_name("iostreams_csv") do |temp_file_name| + ::File.open(temp_file_name, "wb") { |io| new(file_name).each { |lines| io << lines.to_csv } } + ::File.open(temp_file_name, "rb", &block) end end def initialize(file_name) begin - require 'creek' unless defined?(Creek::Book) + require "creek" unless defined?(Creek::Book) rescue LoadError => e raise(LoadError, "Please install the 'creek' gem for xlsx streaming support. #{e.message}") end workbook = Creek::Book.new(file_name, check_file_extension: false)