class InVFS::Zip
Attributes
path[R]
zip[R]
zipfile[R]
Public Class Methods
new(path)
click to toggle source
# File lib/invfs/zip.rb, line 12 def initialize(path) @path = String(path) @zip = ::Zip::File.open(@path) @zipfile = @zip.file end
open(file) → VFS object
click to toggle source
REQUIRED method for VFS Handler.
Open as VFS.
# File lib/invfs/zip.rb, line 101 def Zip.open(file) new file end
probe(file) → true or false
click to toggle source
REQUIRED method for VFS Handler.
Check available as VFS.
# File lib/invfs/zip.rb, line 89 def Zip.probe(file) file.readat(0, 4) == "PK\x03\x04" end
Public Instance Methods
file?(path) → true OR false (OR nil)
click to toggle source
REQUIRED method for VFS.
# File lib/invfs/zip.rb, line 36 def file?(path) zipfile.file?(path) end
inspect()
click to toggle source
# File lib/invfs/zip.rb, line 67 def inspect %(#<#{self.class}:#{path}>) end
pretty_print(q)
click to toggle source
# File lib/invfs/zip.rb, line 71 def pretty_print(q) q.text inspect end
read(path) → string
click to toggle source
REQUIRED method for VFS.
# File lib/invfs/zip.rb, line 56 def read(path) zipfile.read(path) end
size(path) → integer for file size
click to toggle source
REQUIRED method for VFS.
# File lib/invfs/zip.rb, line 46 def size(path) zipfile.size(path) end
to_path → string
click to toggle source
REQUIRED method for VFS.
This value MUST be not modifying in each objects.
# File lib/invfs/zip.rb, line 26 def to_path path end
to_s()
click to toggle source
optional method for VFS.
# File lib/invfs/zip.rb, line 63 def to_s %(#{path} (#{self.class})) end