Class: Zip::FileSystem::DirectoryIterator
- Inherits:
-
Object
- Object
- Zip::FileSystem::DirectoryIterator
- Includes:
- Enumerable
- Defined in:
- lib/zip/filesystem/directory_iterator.rb
Overview
:nodoc:all
Instance Method Summary collapse
- #close ⇒ Object
- #each(&a_proc) ⇒ Object
-
#initialize(filenames) ⇒ DirectoryIterator
constructor
A new instance of DirectoryIterator.
- #read ⇒ Object
- #rewind ⇒ Object
- #seek(position) ⇒ Object
- #tell ⇒ Object
Constructor Details
#initialize(filenames) ⇒ DirectoryIterator
Returns a new instance of DirectoryIterator.
8 9 10 11 |
# File 'lib/zip/filesystem/directory_iterator.rb', line 8 def initialize(filenames) @filenames = filenames @index = 0 end |
Instance Method Details
#close ⇒ Object
13 14 15 |
# File 'lib/zip/filesystem/directory_iterator.rb', line 13 def close @filenames = nil end |
#each(&a_proc) ⇒ Object
17 18 19 20 21 |
# File 'lib/zip/filesystem/directory_iterator.rb', line 17 def each(&a_proc) raise IOError, 'closed directory' if @filenames.nil? @filenames.each(&a_proc) end |
#read ⇒ Object
23 24 25 26 27 |
# File 'lib/zip/filesystem/directory_iterator.rb', line 23 def read raise IOError, 'closed directory' if @filenames.nil? @filenames[(@index += 1) - 1] end |
#rewind ⇒ Object
29 30 31 32 33 |
# File 'lib/zip/filesystem/directory_iterator.rb', line 29 def rewind raise IOError, 'closed directory' if @filenames.nil? @index = 0 end |
#seek(position) ⇒ Object
35 36 37 38 39 |
# File 'lib/zip/filesystem/directory_iterator.rb', line 35 def seek(position) raise IOError, 'closed directory' if @filenames.nil? @index = position end |
#tell ⇒ Object
41 42 43 44 45 |
# File 'lib/zip/filesystem/directory_iterator.rb', line 41 def tell raise IOError, 'closed directory' if @filenames.nil? @index end |