Class: Zip::ZipFileSystem::ZipFsDir

### Home Classes Methods

### In Files

- lib/zip/zipfilesystem.rb

### Parent

Object

### Methods

- ::new
- #chdir
- #chroot
- #delete
- #entries
- #foreach
- #getwd
- #glob
- #mkdir
- #new
- #open
- #pwd
- #rmdir
- #unlink

### Class/Module Index

Quicksearch

- Zip
- Zip::ZipCentralDirectory
- Zip::ZipCompressionMethodError
- Zip::ZipDestinationFileExistsError
- Zip::ZipEntry
- Zip::ZipEntryExistsError
- Zip::ZipEntryNameError
- Zip::ZipError
- Zip::ZipExtraField
- Zip::ZipExtraField::Generic
- Zip::ZipExtraField::IUnix
- Zip::ZipExtraField::UniversalTime
- Zip::ZipFile
- Zip::ZipFileSystem
- Zip::ZipFileSystem::ZipFsDir
- Zip::ZipFileSystem::ZipFsFile
- Zip::ZipFileSystem::ZipFsFile::ZipFsStat
- Zip::ZipInputStream
- Zip::ZipInternalError
- Zip::ZipOutputStream
- Zip::ZipStreamableDirectory
- Zip::ZipStreamableStream
- IOExtras
- IOExtras::AbstractInputStream
- IOExtras::AbstractOutputStream
- IOExtras::FakeIO
- BugFix
- Object

No matching classes.

# Zip::ZipFileSystem::ZipFsDir

Instances of this class are normally accessed via the accessor ZipFile::dir. An instance of ZipFsDir behaves like ruby's builtin Dir (class) object, except it works on ZipFile entries.

The individual methods are not documented due to their similarity with the methods in Dir

### Attributes

file[W]

### Public Class Methods

new(mappedZip) click to toggle source

    # File lib/zip/zipfilesystem.rb, line 431
    def initialize(mappedZip)
      @mappedZip = mappedZip
    end

### Public Instance Methods

chdir(aDirectoryName) click to toggle source

    # File lib/zip/zipfilesystem.rb, line 457
    def chdir(aDirectoryName)
      unless @file.stat(aDirectoryName).directory?
        raise Errno::EINVAL, "Invalid argument - #{aDirectoryName}"
      end
      @mappedZip.pwd = @file.expand_path(aDirectoryName)
    end

chroot(*args) click to toggle source

    # File lib/zip/zipfilesystem.rb, line 502
    def chroot(*args)
      raise NotImplementedError, "The chroot() function is not implemented"
    end

delete(entryName) click to toggle source

    # File lib/zip/zipfilesystem.rb, line 489
    def delete(entryName)
      unless @file.stat(entryName).directory?
        raise Errno::EINVAL, "Invalid argument - #{entryName}"
      end
      @mappedZip.remove(entryName)
    end

Also aliased as: rmdir, unlink
entries(aDirectoryName) click to toggle source

    # File lib/zip/zipfilesystem.rb, line 464
    def entries(aDirectoryName)
      entries = []
      foreach(aDirectoryName) { |e| entries << e }
      entries
    end

foreach(aDirectoryName) click to toggle source

    # File lib/zip/zipfilesystem.rb, line 474
    def foreach(aDirectoryName)
      unless @file.stat(aDirectoryName).directory?
        raise Errno::ENOTDIR, aDirectoryName
      end
      path = @file.expand_path(aDirectoryName)
      path << '/' unless path.end_with?('/')
      path = Regexp.escape(path)
      subDirEntriesRegex = Regexp.new("^#{path}([^/]+)$")
      @mappedZip.each {
        |fileName|
        match = subDirEntriesRegex.match(fileName)
        yield(match[1]) unless match == nil
      }
    end

getwd() click to toggle source
Alias for: pwd
glob(*args,&block) click to toggle source

    # File lib/zip/zipfilesystem.rb, line 470
    def glob(*args,&block)
      @mappedZip.glob(*args,&block)
    end

mkdir(entryName, permissionInt = 0755) click to toggle source

    # File lib/zip/zipfilesystem.rb, line 498
    def mkdir(entryName, permissionInt = 0755)
      @mappedZip.mkdir(entryName, permissionInt)
    end

new(aDirectoryName) click to toggle source

    # File lib/zip/zipfilesystem.rb, line 437
    def new(aDirectoryName)
      ZipFsDirIterator.new(entries(aDirectoryName))
    end

open(aDirectoryName) click to toggle source

    # File lib/zip/zipfilesystem.rb, line 441
    def open(aDirectoryName)
      dirIt = new(aDirectoryName)
      if block_given?
        begin
          yield(dirIt)
          return nil
        ensure
          dirIt.close
        end
      end
      dirIt
    end

pwd() click to toggle source

    # File lib/zip/zipfilesystem.rb, line 454
    def pwd; @mappedZip.pwd; end

Also aliased as: getwd
rmdir(entryName) click to toggle source
Alias for: delete
unlink(entryName) click to toggle source
Alias for: delete

[Validate]

Generated with the Darkfish Rdoc Generator 2.