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.
16 17 18 19 20 |
# File 'lib/invfs/zip.rb', line 16 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.
14 15 16 |
# File 'lib/invfs/zip.rb', line 14 def path @path end |
#zip ⇒ Object (readonly)
Returns the value of attribute zip.
14 15 16 |
# File 'lib/invfs/zip.rb', line 14 def zip @zip end |
#zipfile ⇒ Object (readonly)
Returns the value of attribute zipfile.
14 15 16 |
# File 'lib/invfs/zip.rb', line 14 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.
40 41 42 |
# File 'lib/invfs/zip.rb', line 40 def file?(path) zipfile.file?(path) end |
#inspect ⇒ Object
71 72 73 |
# File 'lib/invfs/zip.rb', line 71 def inspect %(#<#{self.class}:#{path}>) end |
#pretty_print(q) ⇒ Object
75 76 77 |
# File 'lib/invfs/zip.rb', line 75 def pretty_print(q) q.text inspect end |
#read(path) ⇒ Object
call-seq:
read(path) -> string
REQUIRED method for VFS.
60 61 62 |
# File 'lib/invfs/zip.rb', line 60 def read(path) zipfile.read(path) end |
#size(path) ⇒ Object
call-seq:
size(path) -> integer for file size
REQUIRED method for VFS.
50 51 52 |
# File 'lib/invfs/zip.rb', line 50 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.
30 31 32 |
# File 'lib/invfs/zip.rb', line 30 def to_path path end |
#to_s ⇒ Object
optional method for VFS.
67 68 69 |
# File 'lib/invfs/zip.rb', line 67 def to_s %(#{path} (#{self.class})) end |