class Build::Files::List

A list of paths, where each yields instances of Path.

Constants

NONE

Public Class Methods

coerce(arg) click to toggle source
# File lib/build/files/list.rb, line 86
def self.coerce(arg)
        if arg.kind_of? self
                arg
        else
                Paths.new(arg)
        end
end

Public Instance Methods

+(list) click to toggle source

Create a composite list out of two other lists:

# File lib/build/files/list.rb, line 34
def +(list)
        Composite.new([self, list])
end
-(list) click to toggle source
# File lib/build/files/list.rb, line 38
def -(list)
        Difference.new(self, list)
end
==(other) click to toggle source

This isn't very efficient, but it IS generic.

Calls superclass method
# File lib/build/files/list.rb, line 43
def ==(other)
        if self.class == other.class
                self.eql?(other)
        elsif other.kind_of? self.class
                self.to_a.sort == other.to_a.sort
        else
                super
        end
end
create() click to toggle source

Recursively create paths for all listed paths.

# File lib/build/files/system.rb, line 111
def create
        each(&:create)
end
delete() click to toggle source

Recursively delete all paths and all contents within those paths.

# File lib/build/files/system.rb, line 116
def delete
        each(&:delete)
end
exist?() click to toggle source

Check that all files listed exist.

# File lib/build/files/system.rb, line 106
def exist?
        all?(&:exist?)
end
intersects?(other) click to toggle source

Does this list of files include the path of any other?

# File lib/build/files/list.rb, line 54
def intersects? other
        other.any?{|path| include?(path)}
end
map() click to toggle source
Calls superclass method
# File lib/build/files/list.rb, line 82
def map
        Paths.new(super)
end
rebase(root) click to toggle source
# File lib/build/files/list.rb, line 74
def rebase(root)
        Paths.new(self.collect{|path| path.rebase(root)}, [root])
end
roots() click to toggle source
# File lib/build/files/list.rb, line 29
def roots
        collect{|path| path.root}.sort.uniq
end
to_paths() click to toggle source
# File lib/build/files/list.rb, line 78
def to_paths
        Paths.new(each.to_a)
end
to_s() click to toggle source
# File lib/build/files/list.rb, line 94
def to_s
        inspect
end
touch() click to toggle source

Touch all listed files.

# File lib/build/files/system.rb, line 101
def touch
        each(&:touch)
end
with(**options) { |path, updated_path| ... } click to toggle source
# File lib/build/files/list.rb, line 58
def with(**options)
        return to_enum(:with, **options) unless block_given?
        
        paths = []
        
        self.each do |path|
                updated_path = path.with(**options)
                
                yield path, updated_path
                
                paths << updated_path
        end
        
        return Paths.new(paths)
end