lib/io_streams/xlsx/reader.rb in iostreams-0.17.2 vs lib/io_streams/xlsx/reader.rb in iostreams-0.17.3
- old
+ new
@@ -7,14 +7,16 @@
def self.open(file_name_or_io, _ = nil)
if file_name_or_io.is_a?(String)
file_name = file_name_or_io
else
temp_file = Tempfile.new('iostreams_xlsx')
+ temp_file.binmode
IOStreams.copy(file_name_or_io, temp_file)
file_name = temp_file.to_path
end
csv_temp_file = Tempfile.new('iostreams_csv')
+ csv_temp_file.binmode
new(file_name).each { |lines| csv_temp_file << lines.to_csv }
csv_temp_file.rewind
yield csv_temp_file
ensure
temp_file.delete if temp_file