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 73 def self.open(filename) 74 c = new(filename) 75 76 if block_given? 77 begin 78 yield c 79 ensure 80 c.close 81 end 82 end 83 84 c 85 end
Open an existing ZipContainer
. It will be checked for conformance upon first access.
Source
# File lib/zip-container/container.rb 94 def self.verify(filename) 95 new(filename).verify 96 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 117 def self.verify!(filename) 118 new(filename).verify! 119 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).
Source
# File lib/zip-container/container.rb 106 def self.verify?(filename) 107 new(filename).verify? 108 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 126 def verify 127 @mimetype_error.nil? ? verify_managed_entries : [@mimetype_error] 128 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 150 def verify! 151 raise MalformedContainerError, @mimetype_error unless @mimetype_error.nil? 152 153 verify_managed_entries! 154 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 138 def verify? 139 verify.empty? ? true : false 140 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.