class Build::Files::List
A list of paths, where #each yields instances of Path.
def self.coerce(arg)
@parameter arg [List | Object] The object to coerce.
Coerce an argument to a List instance.
def self.coerce(arg) if arg.kind_of? self arg else Paths.new(arg) end end
def +(list)
def +(list) Composite.new([self, list]) end
def -(list)
@parameter list [List] The list to subtract.
Subtract a list from this list.
def -(list) Difference.new(self, list) end
def ==(other)
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
def copy(destination)
Copy all files in the list to a destination.
def copy(destination) each do |path| path.copy(destination / path.relative_path) end end
def create
def create each(&:create) end
def delete
def delete each(&:delete) end
def empty?
Check if the list is empty.
def empty? each do return false end return true end
def exist?
def exist? all?(&:exist?) end
def intersects? other
def intersects? other other.any?{|path| include?(path)} end
def map
@parameter path [Path] The current path.
@yields {|path| ...} Each path in the list.
Map over the list and return a Paths instance.
def map Paths.new(super) end
def rebase(root)
@parameter root [Path] The new root path.
Rebase all paths in the list to a new root.
def rebase(root) Paths.new(self.collect{|path| path.rebase(root)}, [root]) end
def roots
Get all unique root paths from the list.
def roots collect{|path| path.root}.sort.uniq end
def to_paths
Convert the list to a Paths instance.
def to_paths Paths.new(each.to_a) end
def to_s
Convert the list to a string.
def to_s inspect end
def touch
def touch each(&:touch) end
def with(**options)
@parameter updated_path [Path] The modified path.
@parameter path [Path] The original path.
@yields {|path, updated_path| ...} Each original and updated path.
@parameter options [Hash] Options to pass to {Path#with}.
Transform paths with modified attributes.
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