class ZipContainer::ManagedDirectory

A ManagedDirectory acts as the interface to a set of (possibly) managed files within it and also reserves the directory name in the Container namespace.

Once a ManagedDirectory is registered in a Container then only it can be used to write to its contents.

Public Class Methods

new(name, options = {}) → ManagedDirectory click to toggle source

Create a new ManagedDirectory with the supplied name. Options that can be passed in are:

  • :required whether it is required to exist or not (default false).

  • :hidden whether it is hidden for normal operations.

  • :entries a list of ManagedFile and ManagedDirectory objects that are within this directory (default []).

Calls superclass method
# File lib/zip-container/entries/directory.rb, line 56
def initialize(name, options = {})
  options = {
    :required => false,
    :hidden => false,
    :entries => []
  }.merge(options)

  super(name, options[:required], options[:hidden])

  initialize_managed_entries(options[:entries])
end

Public Instance Methods

verify! click to toggle source

Verify this ManagedDirectory for correctness. ManagedFiles registered within it are verified recursively.

A MalformedContainerError is raised if it does not pass verification.

Calls superclass method
# File lib/zip-container/entries/directory.rb, line 75
def verify!
  super
  @files.values.each { |f| f.verify! }
end