summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/util/zip_command.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/axlsx/util/zip_command.rb')
-rw-r--r--lib/axlsx/util/zip_command.rb10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/axlsx/util/zip_command.rb b/lib/axlsx/util/zip_command.rb
index 00faa942..e43ba03d 100644
--- a/lib/axlsx/util/zip_command.rb
+++ b/lib/axlsx/util/zip_command.rb
@@ -40,23 +40,21 @@ module Axlsx
@current_file = "#{@dir}/#{entry.name}"
@files << entry.name
FileUtils.mkdir_p(File.dirname(@current_file))
+ @io = File.open(@current_file, "wb")
end
# Write to a buffer that will be written to the current entry
def write(content)
- @buffer << content
+ @io << content
end
alias << write
private
def write_file
- if @current_file
- @buffer.rewind
- File.open(@current_file, "wb") { |f| f.write @buffer.read }
- end
+ @io.close if @current_file
@current_file = nil
- @buffer = StringIO.new
+ @io = nil
end
def zip_parts(output)