class ChupaText::Decomposers::Tar
Public Instance Methods
Source
# File lib/chupa-text/decomposers/tar.rb, line 31 def decompose(data) data.open do |input| Gem::Package::TarReader.new(input) do |reader| reader.each do |entry| next unless entry.file? entry.extend(CopyStreamable) entry_uri = data.uri.dup base_path = entry_uri.path.gsub(/\.tar\z/i, "") path_converter = PathConverter.new(entry.full_name, uri_escape: true) entry_uri.path = "#{base_path}/#{path_converter.convert}" entry_data = VirtualFileData.new(entry_uri, entry, :source_data => data) yield(entry_data) end end end end
Source
# File lib/chupa-text/decomposers/tar.rb, line 26 def target?(data) data.extension == "tar" or data.mime_type == "application/x-tar" end