Module: Zipline
- Defined in:
- lib/zipline.rb,
lib/zipline/version.rb,
lib/zipline/zip_generator.rb
Overview
this class acts as a streaming body for rails initialize it with an array of the files you want to zip
Defined Under Namespace
Classes: ZipGenerator
Constant Summary collapse
- VERSION =
"1.5.0"
Instance Method Summary collapse
Instance Method Details
#zipline(files, zipname = 'zipline.zip', **kwargs_for_new) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/zipline.rb', line 15 def zipline(files, zipname = 'zipline.zip', **kwargs_for_new) zip_generator = ZipGenerator.new(files, **kwargs_for_new) headers['Content-Disposition'] = ContentDisposition.format(disposition: 'attachment', filename: zipname) headers['Content-Type'] = Mime::Type.lookup_by_extension('zip').to_s response.sending_file = true response.cache_control[:public] ||= false self.response_body = zip_generator self.response.headers['Last-Modified'] = Time.now.httpdate end |