class Build::Files::Glob
Represents a glob pattern for matching files.
def each(&block)
def each(&block) return to_enum unless block_given? ::Dir.glob(full_pattern, ::File::FNM_DOTMATCH) do |path| # Ignore `.` and `..` entries. next if path =~ /\/..?$/ yield Path.new(path, @root) end end
def eql?(other)
@parameter other [Glob] The other glob to compare.
Check equality with another glob.
def eql?(other) self.class.eql?(other.class) and @root.eql?(other.root) and @pattern.eql?(other.pattern) end
def full_pattern
Get the full pattern including the root path.
def full_pattern Path.join(@root, @pattern) end
def hash
Compute the hash value for this glob.
def hash [@root, @pattern].hash end
def include?(path)
@parameter path [Path] The path to check.
Check if a path matches this glob pattern.
def include?(path) File.fnmatch(full_pattern, path) end
def initialize(root, pattern)
@parameter root [Path] The root directory for the glob.
Initialize a glob with a root path and pattern.
def initialize(root, pattern) @root = root @pattern = pattern end
def inspect
Generate a string representation for debugging.
def inspect "<Glob #{full_pattern.inspect}>" end
def rebase(root)
@parameter root [Path] The new root path.
Rebase the glob to a new root.
def rebase(root) self.class.new(root, @pattern) end
def roots
Get the root paths for this glob.
def roots [@root] end