class ChupaText::Decomposers::Zip
Public Instance Methods
decompose(data) { |entry_data| ... }
click to toggle source
# File lib/chupa-text/decomposers/zip.rb, line 34 def decompose(data) unzip(data) do |zip| zip.each do |entry| next unless entry.file? case entry.encryption_codec when Archive::Zip::Codec::NullEncryption else # TODO # entry.password = ... raise EncryptedError.new(data) end entry_uri = data.uri.dup base_path = entry_uri.path.gsub(/\.zip\z/i, "") path_converter = PathConverter.new(entry.zip_path, encoding: base_path.encoding, uri_escape: true) entry_uri.path = "#{base_path}/#{path_converter.convert}" entry_data = VirtualFileData.new(entry_uri, entry.file_data, source_data: data) yield(entry_data) end end end
target?(data)
click to toggle source
# File lib/chupa-text/decomposers/zip.rb, line 27 def target?(data) return true if data.extension == "zip" return true if data.mime_type == "application/zip" false end
Private Instance Methods
log_tag()
click to toggle source
# File lib/chupa-text/decomposers/zip.rb, line 61 def log_tag "[decomposer][zip]" end