class Xlsxtream::IO::ZipTricks
Constants
- BUFFER_SIZE
Public Class Methods
new(body)
click to toggle source
# File lib/xlsxtream/io/zip_tricks.rb, line 9 def initialize(body) @streamer = ::ZipTricks::Streamer.new(body) @wf = nil @buffer = String.new end
Public Instance Methods
<<(data)
click to toggle source
# File lib/xlsxtream/io/zip_tricks.rb, line 15 def <<(data) @buffer << data flush_buffer if @buffer.size >= BUFFER_SIZE self end
add_file(path)
click to toggle source
# File lib/xlsxtream/io/zip_tricks.rb, line 21 def add_file(path) flush_file @wf = @streamer.write_deflated_file(path) end
close()
click to toggle source
# File lib/xlsxtream/io/zip_tricks.rb, line 26 def close flush_file @streamer.close end
Private Instance Methods
flush_buffer()
click to toggle source
# File lib/xlsxtream/io/zip_tricks.rb, line 33 def flush_buffer @wf << @buffer @buffer.clear end
flush_file()
click to toggle source
# File lib/xlsxtream/io/zip_tricks.rb, line 38 def flush_file return unless @wf flush_buffer if @buffer.size > 0 @wf.close end