Class: Zip::ZipFileSystem::ZipFsDirIterator

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

Overview

:nodoc:all

Instance Method Summary collapse

Methods included from Enumerable

#inject, #select_map

Constructor Details

#initialize(arrayOfFileNames) ⇒ ZipFsDirIterator

Returns a new instance of ZipFsDirIterator.



519
520
521
522
# File 'lib/ruby_archive/handlers/rubyzip/zip/zipfilesystem.rb', line 519

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

Instance Method Details

#closeObject



524
525
526
# File 'lib/ruby_archive/handlers/rubyzip/zip/zipfilesystem.rb', line 524

def close
  @fileNames = nil
end

#each(&aProc) ⇒ Object

Raises:

  • (IOError)


528
529
530
531
# File 'lib/ruby_archive/handlers/rubyzip/zip/zipfilesystem.rb', line 528

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

#readObject

Raises:

  • (IOError)


533
534
535
536
# File 'lib/ruby_archive/handlers/rubyzip/zip/zipfilesystem.rb', line 533

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

#rewindObject

Raises:

  • (IOError)


538
539
540
541
# File 'lib/ruby_archive/handlers/rubyzip/zip/zipfilesystem.rb', line 538

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

#seek(anIntegerPosition) ⇒ Object

Raises:

  • (IOError)


543
544
545
546
# File 'lib/ruby_archive/handlers/rubyzip/zip/zipfilesystem.rb', line 543

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

#tellObject

Raises:

  • (IOError)


548
549
550
551
# File 'lib/ruby_archive/handlers/rubyzip/zip/zipfilesystem.rb', line 548

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