Class: InVFS::Zip
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#zip ⇒ Object
readonly
Returns the value of attribute zip.
-
#zipfile ⇒ Object
readonly
Returns the value of attribute zipfile.
Class Method Summary collapse
-
.open(file) ⇒ Object
call-seq: open(file) -> VFS object.
-
.probe(file) ⇒ Object
call-seq: probe(file) -> true or false.
Instance Method Summary collapse
-
#file?(path) ⇒ Boolean
call-seq: file?(path) -> true OR false (OR nil).
-
#initialize(path) ⇒ Zip
constructor
A new instance of Zip.
- #inspect ⇒ Object
- #pretty_print(q) ⇒ Object
-
#read(path) ⇒ Object
call-seq: read(path) -> string.
-
#size(path) ⇒ Object
call-seq: size(path) -> integer for file size.
-
#to_path ⇒ Object
call-seq: to_path -> string.
-
#to_s ⇒ Object
optional method for VFS.
Constructor Details
#initialize(path) ⇒ Zip
Returns a new instance of Zip.
12 13 14 15 16 |
# File 'lib/invfs/zip.rb', line 12 def initialize(path) @path = String(path) @zip = ::Zip::File.open(@path) @zipfile = @zip.file end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
10 11 12 |
# File 'lib/invfs/zip.rb', line 10 def path @path end |
#zip ⇒ Object (readonly)
Returns the value of attribute zip.
10 11 12 |
# File 'lib/invfs/zip.rb', line 10 def zip @zip end |
#zipfile ⇒ Object (readonly)
Returns the value of attribute zipfile.
10 11 12 |
# File 'lib/invfs/zip.rb', line 10 def zipfile @zipfile end |
Class Method Details
Instance Method Details
#file?(path) ⇒ Boolean
call-seq:
file?(path) -> true OR false (OR nil)
REQUIRED method for VFS.
36 37 38 |
# File 'lib/invfs/zip.rb', line 36 def file?(path) zipfile.file?(path) end |
#inspect ⇒ Object
67 68 69 |
# File 'lib/invfs/zip.rb', line 67 def inspect %(#<#{self.class}:#{path}>) end |
#pretty_print(q) ⇒ Object
71 72 73 |
# File 'lib/invfs/zip.rb', line 71 def pretty_print(q) q.text inspect end |
#read(path) ⇒ Object
call-seq:
read(path) -> string
REQUIRED method for VFS.
56 57 58 |
# File 'lib/invfs/zip.rb', line 56 def read(path) zipfile.read(path) end |
#size(path) ⇒ Object
call-seq:
size(path) -> integer for file size
REQUIRED method for VFS.
46 47 48 |
# File 'lib/invfs/zip.rb', line 46 def size(path) zipfile.size(path) end |
#to_path ⇒ Object
call-seq:
to_path -> string
REQUIRED method for VFS.
This value MUST be not modifying in each objects.
26 27 28 |
# File 'lib/invfs/zip.rb', line 26 def to_path path end |
#to_s ⇒ Object
optional method for VFS.
63 64 65 |
# File 'lib/invfs/zip.rb', line 63 def to_s %(#{path} (#{self.class})) end |