class ZipContainer::Container

The superclass of anything that represents a Zip Container. That representation could be as a Zip file (most commonly), as a directory or something else.

Attributes

mimetype[R]

The mime-type of this ZipContainer.

Public Class Methods

open(filename) → container click to toggle source
open(filename) {|container| ...}

Open an existing ZipContainer. It will be checked for conformance upon first access.

# File lib/zip-container/container.rb, line 72
def self.open(filename, &block)
  c = new(filename)

  if block_given?
    begin
      yield c
    ensure
      c.close
    end
  end

  c
end
verify(filename) → boolean click to toggle source

Verify that the specified ZipContainer conforms to the specification. This method returns false if there are any problems at all with the container (including if it cannot be found).

# File lib/zip-container/container.rb, line 92
def self.verify(filename)
  begin
    new(filename).verify!
  rescue
    return false
  end

  true
end
verify!(filename) click to toggle source

Verify that the specified ZipContainer conforms to the specification. This method raises exceptions when errors are found or if there is something fundamental wrong with the container itself (e.g. it cannot be found).

# File lib/zip-container/container.rb, line 109
def self.verify!(filename)
  new(filename).verify!
end

Public Instance Methods

verify! click to toggle source

Verify the contents of this ZipContainer file. All managed files and directories are checked to make sure that they exist, if required.

# File lib/zip-container/container.rb, line 118
def verify!
  verify_managed_entries!
end