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
96 97 98 99 |
# File 'lib/rio/ext/zipfile/wrap.rb', line 96 def close p "JERE" @zipfile.commit if @zipfile.commit_required? end |
#each(&block) ⇒ Object
91 92 93 94 95 |
# File 'lib/rio/ext/zipfile/wrap.rb', line 91 def each(&block) get_topents_.each { |ent| yield ent } end |
#get_topents_ ⇒ Object
78 79 80 81 82 83 84 85 |
# File 'lib/rio/ext/zipfile/wrap.rb', line 78 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
86 87 88 89 90 |
# File 'lib/rio/ext/zipfile/wrap.rb', line 86 def read return nil if @entidx >= @topents.size @entidx += 1 @topents[@entidx-1] end |