| Class | Ole::Storage::DirClass::Dir |
| In: |
lib/ole/storage/file_system.rb
|
| Parent: | Object |
note that there is nothing remotely ole specific about this class. it simply provides the dir like sequential access methods on top of an array. hmm, doesn‘t throw the IOError‘s on use of a closed directory…
| path | [R] |
# File lib/ole/storage/file_system.rb, line 381
381: def initialize path, entries
382: @path, @entries, @pos = path, entries, 0
383: @closed = false
384: end
# File lib/ole/storage/file_system.rb, line 391
391: def each(&block)
392: raise IOError if @closed
393: @entries.each(&block)
394: end
# File lib/ole/storage/file_system.rb, line 386
386: def pos
387: raise IOError if @closed
388: @pos
389: end
# File lib/ole/storage/file_system.rb, line 407
407: def pos= pos
408: raise IOError if @closed
409: @pos = [[0, pos].max, @entries.length].min
410: end
# File lib/ole/storage/file_system.rb, line 400
400: def read
401: raise IOError if @closed
402: @entries[pos]
403: ensure
404: @pos += 1 if pos < @entries.length
405: end