Class: Zip::ZipFileSystem::ZipFsDirIterator

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

Instance Method Summary collapse

Methods included from Enumerable

#deep_clone, #deep_dup, #inject, #select_map

Constructor Details

#initialize(arrayOfFileNames) ⇒ ZipFsDirIterator

Returns a new instance of ZipFsDirIterator.



447
448
449
450
# File 'lib/zip/zipfilesystem.rb', line 447

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

Instance Method Details

#closeObject



452
453
454
# File 'lib/zip/zipfilesystem.rb', line 452

def close
  @fileNames = nil
end

#each(&aProc) ⇒ Object

Raises:

  • (IOError)


456
457
458
459
# File 'lib/zip/zipfilesystem.rb', line 456

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

#readObject

Raises:

  • (IOError)


461
462
463
464
# File 'lib/zip/zipfilesystem.rb', line 461

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

#rewindObject

Raises:

  • (IOError)


466
467
468
469
# File 'lib/zip/zipfilesystem.rb', line 466

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

#seek(anIntegerPosition) ⇒ Object

Raises:

  • (IOError)


471
472
473
474
# File 'lib/zip/zipfilesystem.rb', line 471

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

#tellObject

Raises:

  • (IOError)


476
477
478
479
# File 'lib/zip/zipfilesystem.rb', line 476

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