class Build::Files::Directory
Represents a directory of files.
def self.join(*args)
@parameter args [Array(String)] The path components to join.
Join path components and create a directory.
def self.join(*args) self.new(Path.join(*args)) end
def each
@yields {|path| ...} Each file path in the directory.
Iterate over all files in the directory recursively.
def each return to_enum(:each) unless block_given? # We match both normal files with * and dotfiles with .?* Dir.glob(@root + "**/{*,.?*}") do |path| yield Path.new(path, @root) end end
def eql?(other)
@parameter other [Directory] The other directory to compare.
Check equality with another directory.
def eql?(other) self.class.eql?(other.class) and @root.eql?(other.root) end
def hash
Compute the hash value for this directory.
def hash @root.hash end
def include?(path)
@parameter path [Path] The path to check.
Check if the directory includes a specific path.
def include?(path) # Would be true if path is a descendant of full_path. path.start_with?(@root) end
def initialize(root)
Initialize a directory with a root path.
def initialize(root) @root = root end
def rebase(root)
@parameter root [Path] The new root path.
Rebase the directory to a new root.
def rebase(root) self.class.new(@root.rebase(root)) end
def root
Get the root path of the directory.
def root @root end
def roots
Get the root paths as an array.
def roots [root] end
def to_path
Convert the directory to a path object.
def to_path @root end
def to_s
Convert the directory to a string.
def to_s to_str end
def to_str
Convert the directory to a string for use as a command argument.
def to_str @root.to_str end