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
Source
# File lib/zip-container/entries/directory.rb 57 def initialize(name, options = {}) 58 options = { 59 required: false, 60 hidden: false, 61 entries: [] 62 }.merge(options) 63 64 super(name, options[:required], options[:hidden]) 65 66 initialize_managed_entries(options[:entries]) 67 end
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 ofManagedFile
andManagedDirectory
objects that are within this directory (default []).
Public Instance Methods
Source
# File lib/zip-container/entries/directory.rb 77 def verify 78 messages = super 79 80 @files.values.each { |f| messages += f.verify } 81 82 messages 83 end
Verify this ManagedDirectory
for correctness. ManagedFiles registered within it are verified recursively.
If it does not pass verification a list of reasons why it fails is returned. The empty list is returned if verification passes.