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
The mime-type of this ZipContainer.
Public Class Methods
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 that the specified ZipContainer conforms to the specification. This method returns a list of problems with the container.
Exceptions are still raised for fundamental file system errors.
# File lib/zip-container/container.rb, line 93 def self.verify(filename) new(filename).verify end
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 116 def self.verify!(filename) new(filename).verify! end
Verify that the specified ZipContainer
conforms to the specification. This method returns false
if
there are any problems at all with the container.
Exceptions are still raised for fundamental file system errors.
# File lib/zip-container/container.rb, line 105 def self.verify?(filename) new(filename).verify? end
Public Instance Methods
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 125 def verify @mimetype_error.nil? ? verify_managed_entries : [@mimetype_error] end
Verify the contents of this ZipContainer file. All managed files and directories are checked to make sure that they exist, if required.
This method raises a MalformedContainerError if there are any problems with the container.
# File lib/zip-container/container.rb, line 149 def verify! unless @mimetype_error.nil? raise MalformedContainerError.new(@mimetype_error) end verify_managed_entries! end
Verify the contents of this ZipContainer file. All managed files and directories are checked to make sure that they exist, if required.
This method returns false
if there are any problems at all
with the container.
# File lib/zip-container/container.rb, line 137 def verify? verify.empty? ? true : false end