class Build::Files::Composite

Attributes

files[R]

Public Class Methods

new(files, roots = nil) click to toggle source
# File lib/build/files/composite.rb, line 26
def initialize(files, roots = nil)
        @files = []
        
        files.each do |list|
                if list.kind_of? Composite
                        @files += list.files
                elsif List.kind_of? List
                        @files << list
                else
                        # Try to convert into a explicit paths list:
                        @files << Paths.new(list)
                end
        end
        
        @files.freeze
        @roots = roots
end

Public Instance Methods

+(list) click to toggle source
# File lib/build/files/composite.rb, line 72
def +(list)
        if list.kind_of? Composite
                self.class.new(@files + list.files)
        else
                self.class.new(@files + [list])
        end
end
each() { |path| ... } click to toggle source
# File lib/build/files/composite.rb, line 52
def each
        return to_enum(:each) unless block_given?
        
        @files.each do |files|
                files.each{|path| yield path}
        end
end
eql?(other) click to toggle source
# File lib/build/files/composite.rb, line 64
def eql?(other)
        self.class.eql?(other.class) and @files.eql?(other.files)
end
freeze() click to toggle source
Calls superclass method
# File lib/build/files/composite.rb, line 46
def freeze
        self.roots
        
        super
end
hash() click to toggle source
# File lib/build/files/composite.rb, line 68
def hash
        @files.hash
end
include?(path) click to toggle source
# File lib/build/files/composite.rb, line 80
def include?(path)
        @files.any? {|list| list.include?(path)}
end
inspect() click to toggle source
# File lib/build/files/composite.rb, line 92
def inspect
        "<Composite #{@files.inspect}>"
end
rebase(root) click to toggle source
# File lib/build/files/composite.rb, line 84
def rebase(root)
        self.class.new(@files.collect{|list| list.rebase(root)}, [root])
end
roots() click to toggle source
# File lib/build/files/composite.rb, line 60
def roots
        @roots ||= @files.collect(&:roots).flatten.uniq
end
to_paths() click to toggle source
# File lib/build/files/composite.rb, line 88
def to_paths
        self.class.new(@files.collect(&:to_paths), roots: @roots)
end