class AndFeathers::Tarball::Directory
Represents a Directory
inside the tarball
Attributes
mode[R]
name[R]
Public Class Methods
new(name, mode, parent)
click to toggle source
Creates a new Directory
@param name [String] the directory name @param mode [Fixnum] the directory mode @param parent [Directory, Tarball] the parent entity of this directory
# File lib/and_feathers/tarball/directory.rb, line 30 def initialize(name, mode, parent) @name = name @mode = mode @parent = parent @children = [] end
Public Instance Methods
each(&block)
click to toggle source
Iterates through this Directory
‘s children down to each leaf child.
@yieldparam child [File, Directory]
# File lib/and_feathers/tarball/directory.rb, line 51 def each(&block) files, subdirectories = @children.partition do |child| child.is_a?(File) end files.each(&block) subdirectories.each do |subdirectory| block.call(subdirectory) subdirectory.each(&block) end end
path()
click to toggle source
This Directory
‘s path
@return [String]
# File lib/and_feathers/tarball/directory.rb, line 42 def path ::File.join(@parent.path, name) end