Class: Rapidmail::Utils::ZipEncoder
- Inherits:
-
Object
- Object
- Rapidmail::Utils::ZipEncoder
- Defined in:
- lib/rapidmail/utils/zip_encoder.rb
Overview
Utility class for encoding files into a zip archive and then Base64 encoding the result.
Class Method Summary collapse
-
.encode(files) ⇒ String
Encodes the given files into a zip archive and then Base64 encodes the result.
Class Method Details
.encode(files) ⇒ String
Encodes the given files into a zip archive and then Base64 encodes the result.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/rapidmail/utils/zip_encoder.rb', line 12 def self.encode(files) zip_data = Zip::OutputStream.write_buffer do |zip| files.each do |filename, content| zip.put_next_entry(filename) zip.write content end end Base64.strict_encode64(zip_data.string) end |