Module: AndFeathers::Tarball::ContainsDirectories

Included in:
AndFeathers::Tarball, Directory
Defined in:
lib/and_feathers/tarball/contains_directories.rb

Overview

A module which gives instances of a class the dir DSL method

Instance Method Summary collapse

Instance Method Details

#dir(name, mode = 16877) {|directory| ... } ⇒ Object

Add a Directory named name to this entity’s list of children

Parameters:

  • name (String)

    the directory name

  • mode (Fixnum) (defaults to: 16877)

    the directory mode

Yield Parameters:

  • directory (Directory)

    the newly-created Directory



15
16
17
18
19
20
21
# File 'lib/and_feathers/tarball/contains_directories.rb', line 15

def dir(name, mode = 16877, &block)
  Directory.new(name, mode, self).tap do |subdir|
    block.call(subdir) if block

    @children.push(subdir)
  end
end