Class: TxghServer::ZipStreamResponse
- Inherits:
-
StreamResponse
- Object
- StreamResponse
- TxghServer::ZipStreamResponse
- Defined in:
- lib/txgh-server/zip_stream_response.rb
Instance Attribute Summary
Attributes inherited from StreamResponse
Instance Method Summary collapse
Methods inherited from StreamResponse
#error, #headers, #initialize, #streaming?
Constructor Details
This class inherits a constructor from TxghServer::StreamResponse
Instance Method Details
#file_extension ⇒ Object
15 16 17 |
# File 'lib/txgh-server/zip_stream_response.rb', line 15 def file_extension '.zip' end |
#write_to(stream) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/txgh-server/zip_stream_response.rb', line 6 def write_to(stream) Zipline::OutputStream.open(stream) do |zipfile| enum.each do |file_name, contents| zipfile.put_next_entry(file_name, contents.bytesize) zipfile << contents end end end |