Class: RIO::ZipFile::Wrap::Stream::Root
- Defined in:
- lib/rio/ext/zipfile/wrap.rb
Instance Method Summary collapse
- #close ⇒ Object
- #each(&block) ⇒ Object
- #get_topents_ ⇒ Object
-
#initialize(zipfile) ⇒ Root
constructor
A new instance of Root.
- #read ⇒ Object
Constructor Details
Instance Method Details
#close ⇒ Object
82 83 84 |
# File 'lib/rio/ext/zipfile/wrap.rb', line 82 def close @zipfile.commit if @zipfile.commit_required? end |
#each(&block) ⇒ Object
77 78 79 80 81 |
# File 'lib/rio/ext/zipfile/wrap.rb', line 77 def each(&block) get_topents_.each { |ent| yield ent } end |
#get_topents_ ⇒ Object
64 65 66 67 68 69 70 71 |
# File 'lib/rio/ext/zipfile/wrap.rb', line 64 def get_topents_ topents = {} @zipfile.entries.map{ |ent| top = ent.to_s.match(%r|^(/?[^/]+(/)?)|)[1] topents[top] = 1 unless topents.has_key?(top) } topents.keys.map{ |v| rio(RIO::Path::RL.new(v.to_s,{:fs => @infs})) } end |
#read ⇒ Object
72 73 74 75 76 |
# File 'lib/rio/ext/zipfile/wrap.rb', line 72 def read return nil if @entidx >= @topents.size @entidx += 1 @topents[@entidx-1] end |