Class: Xlsxtream::IO::RubyZip
- Inherits:
-
Object
- Object
- Xlsxtream::IO::RubyZip
- Defined in:
- lib/xlsxtream/io/rubyzip.rb
Instance Method Summary collapse
- #<<(data) ⇒ Object
- #add_file(path) ⇒ Object
- #close ⇒ Object
-
#initialize(io) ⇒ RubyZip
constructor
A new instance of RubyZip.
Constructor Details
#initialize(io) ⇒ RubyZip
Returns a new instance of RubyZip.
8 9 10 11 12 13 14 15 |
# File 'lib/xlsxtream/io/rubyzip.rb', line 8 def initialize(io) unless io.respond_to? :pos and io.respond_to? :pos= raise Error, 'IO is not seekable' end io.binmode if io.respond_to? :binmode stream = true @zos = Zip::OutputStream.new(io, stream) end |
Instance Method Details
#<<(data) ⇒ Object
17 18 19 |
# File 'lib/xlsxtream/io/rubyzip.rb', line 17 def <<(data) @zos << data end |
#add_file(path) ⇒ Object
21 22 23 |
# File 'lib/xlsxtream/io/rubyzip.rb', line 21 def add_file(path) @zos.put_next_entry path end |
#close ⇒ Object
25 26 27 28 |
# File 'lib/xlsxtream/io/rubyzip.rb', line 25 def close os = @zos.close_buffer os.flush if os.respond_to? :flush end |