Class: Zip::ZipFileSystem::ZipFsDirIterator

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/zip/zipfilesystem.rb

Overview

:nodoc:all

Instance Method Summary collapse

Constructor Details

#initialize(arrayOfFileNames) ⇒ ZipFsDirIterator

Returns a new instance of ZipFsDirIterator.



511
512
513
514
# File 'lib/zip/zipfilesystem.rb', line 511

def initialize(arrayOfFileNames)
  @fileNames = arrayOfFileNames
  @index = 0
end

Instance Method Details

#closeObject



516
517
518
# File 'lib/zip/zipfilesystem.rb', line 516

def close
  @fileNames = nil
end

#each(&aProc) ⇒ Object

Raises:

  • (IOError)


520
521
522
523
# File 'lib/zip/zipfilesystem.rb', line 520

def each(&aProc)
  raise IOError, "closed directory" if @fileNames == nil
  @fileNames.each(&aProc)
end

#readObject

Raises:

  • (IOError)


525
526
527
528
# File 'lib/zip/zipfilesystem.rb', line 525

def read
  raise IOError, "closed directory" if @fileNames == nil
  @fileNames[(@index+=1)-1]
end

#rewindObject

Raises:

  • (IOError)


530
531
532
533
# File 'lib/zip/zipfilesystem.rb', line 530

def rewind
  raise IOError, "closed directory" if @fileNames == nil
  @index = 0
end

#seek(anIntegerPosition) ⇒ Object

Raises:

  • (IOError)


535
536
537
538
# File 'lib/zip/zipfilesystem.rb', line 535

def seek(anIntegerPosition)
  raise IOError, "closed directory" if @fileNames == nil
  @index = anIntegerPosition
end

#tellObject

Raises:

  • (IOError)


540
541
542
543
# File 'lib/zip/zipfilesystem.rb', line 540

def tell
  raise IOError, "closed directory" if @fileNames == nil
  @index
end