Class: Glark::ZipFile
- Inherits:
-
ArchiveFile
show all
- Includes:
- Logue::Loggable
- Defined in:
- lib/glark/io/file/zip_file.rb
Instance Method Summary
collapse
Methods inherited from ArchiveFile
#each, #list, #search, #search_archive_file, #search_list
Constructor Details
#initialize(fname, range, &blk) ⇒ ZipFile
Returns a new instance of ZipFile.
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/glark/io/file/zip_file.rb', line 12
def initialize fname, range, &blk
super fname, range
begin
require 'zip/zip'
rescue LoadError => e
msg = "error loading zip gem: #{e}\n"
msg << "to install this dependency, run 'gem install rubyzip'"
info "msg: #{msg}".color(:red)
raise msg
end
end
|
Instance Method Details
#entry_name(entry) ⇒ Object
37
38
39
|
# File 'lib/glark/io/file/zip_file.rb', line 37
def entry_name entry
entry.name
end
|
#get_reader ⇒ Object
29
30
31
|
# File 'lib/glark/io/file/zip_file.rb', line 29
def get_reader
@zipfile = Zip::ZipFile.new @fname
end
|
#read(entry) ⇒ Object
33
34
35
|
# File 'lib/glark/io/file/zip_file.rb', line 33
def read entry
@zipfile.read entry
end
|