class Distillery::Archiver::LibArchive

Use binding to libarchive

Constants

MODE

Public Class Methods

new(mode) click to toggle source
# File lib/distillery/archiver/libarchive.rb, line 66
def initialize(mode)
    raise ArgumentError unless MODE.include?(mode)
    @mode = mode
end
registering() click to toggle source
# File lib/distillery/archiver/libarchive.rb, line 59
def self.registering
    MODE.each_key {|mode|
        Archiver.register(LibArchive.new(mode))
    }
end

Public Instance Methods

each(file, &block) click to toggle source

(see Archiver#each)

# File lib/distillery/archiver/libarchive.rb, line 87
def each(file, &block)
    ::Archive.read_open_filename(file) {|ar|
        while a_entry = ar.next_header
            next unless a_entry.regular?
            $stdout.puts a_entry.pathname
            block.call(a_entry.pathname, InputStream.new(ar))
        end
    }
    self
end
extensions() click to toggle source

List of supported extensions

# File lib/distillery/archiver/libarchive.rb, line 74
def extensions
    MODE[@mode][:extensions]
end
mimetypes() click to toggle source

List of supported mimetypes

# File lib/distillery/archiver/libarchive.rb, line 81
def mimetypes
    MODE[@mode][:mimetypes]
end