class Build::Files::Glob

Attributes

pattern[R]
root[R]

Public Class Methods

new(root, pattern) click to toggle source
# File lib/build/files/glob.rb, line 32
def initialize(root, pattern)
        @root = root
        @pattern = pattern
end

Public Instance Methods

each() { |path| ... } click to toggle source

Enumerate all paths matching the pattern.

# File lib/build/files/glob.rb, line 49
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
eql?(other) click to toggle source
# File lib/build/files/glob.rb, line 60
def eql?(other)
        self.class.eql?(other.class) and @root.eql?(other.root) and @pattern.eql?(other.pattern)
end
full_pattern() click to toggle source
# File lib/build/files/glob.rb, line 44
def full_pattern
        Path.join(@root, @pattern)
end
hash() click to toggle source
# File lib/build/files/glob.rb, line 64
def hash
        [@root, @pattern].hash
end
include?(path) click to toggle source
# File lib/build/files/glob.rb, line 68
def include?(path)
        File.fnmatch(full_pattern, path)
end
inspect() click to toggle source
# File lib/build/files/glob.rb, line 76
def inspect
        "<Glob #{full_pattern.inspect}>"
end
rebase(root) click to toggle source
# File lib/build/files/glob.rb, line 72
def rebase(root)
        self.class.new(root, @pattern)
end
roots() click to toggle source
# File lib/build/files/glob.rb, line 40
def roots
        [@root]
end