Class: Zip::FileSystem::ZipFsDirIterator

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

Overview

:nodoc:all

Instance Method Summary collapse

Constructor Details

#initialize(filenames) ⇒ ZipFsDirIterator

Returns a new instance of ZipFsDirIterator.



519
520
521
522
# File 'lib/zip/filesystem.rb', line 519

def initialize(filenames)
  @filenames = filenames
  @index = 0
end

Instance Method Details

#closeObject



524
525
526
# File 'lib/zip/filesystem.rb', line 524

def close
  @filenames = nil
end

#each(&a_proc) ⇒ Object

Raises:

  • (IOError)


528
529
530
531
532
# File 'lib/zip/filesystem.rb', line 528

def each(&a_proc)
  raise IOError, 'closed directory' if @filenames.nil?

  @filenames.each(&a_proc)
end

#readObject

Raises:

  • (IOError)


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

def read
  raise IOError, 'closed directory' if @filenames.nil?

  @filenames[(@index += 1) - 1]
end

#rewindObject

Raises:

  • (IOError)


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

def rewind
  raise IOError, 'closed directory' if @filenames.nil?

  @index = 0
end

#seek(position) ⇒ Object

Raises:

  • (IOError)


546
547
548
549
550
# File 'lib/zip/filesystem.rb', line 546

def seek(position)
  raise IOError, 'closed directory' if @filenames.nil?

  @index = position
end

#tellObject

Raises:

  • (IOError)


552
553
554
555
556
# File 'lib/zip/filesystem.rb', line 552

def tell
  raise IOError, 'closed directory' if @filenames.nil?

  @index
end