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 73 def self.open(filename) 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 94 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 117 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 106 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 126 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 150 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 returns false
if there are any problems at all with the container.
# File lib/zip-container/container.rb, line 138 def verify? verify.empty? ? true : false end