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
Source
# File lib/zip-container/container.rb, line 77 def self.open(filename) c = new(filename) if block_given? begin yield c ensure c.close end end c end
Open an existing ZipContainer
. It will be checked for conformance upon first access.
Source
# File lib/zip-container/container.rb, line 98 def self.verify(filename) new(filename).verify 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.
Source
# File lib/zip-container/container.rb, line 120 def self.verify!(filename) new(filename).verify! end
Verify that the specified ZipContainer
conforms to the specification. This method raises an error if there is something fundamental wrong with the container itself (e.g. it cannot be found).
Source
# File lib/zip-container/container.rb, line 110 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.
Public Instance Methods
Source
# File lib/zip-container/container.rb, line 129 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.
Source
# File lib/zip-container/container.rb, line 153 def verify! raise MalformedContainerError, @mimetype_error unless @mimetype_error.nil? 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 raises a MalformedContainerError
if there are any problems with the container.
Source
# File lib/zip-container/container.rb, line 141 def verify? verify.empty? 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.