class Build::Files::Paths

Represents an explicit list of file paths.

def self.directory(root, relative_paths)

@returns [Paths] A new paths list.
@parameter relative_paths [Array(String)] The relative paths.
@parameter root [Path] The root directory.
Create a paths list from a directory root and relative paths.
def self.directory(root, relative_paths)
	paths = relative_paths.collect do |path|
		Path.join(root, path)
	end
	
	self.new(paths, [root])
end

def count

@returns [Integer] The number of paths.
Get the count of paths in the list.
def count
	@list.count
end

def each

@parameter path [Path] The current path.
@yields {|path| ...} Each path in the list.
Iterate over all paths in the list.
def each
	return to_enum(:each) unless block_given?
	
	@list.each{|path| yield path}
end

def eql?(other)

@returns [Boolean] True if both have the same paths.
@parameter other [Paths] The other paths list to compare.
Check equality with another paths list.
def eql?(other)
	self.class.eql?(other.class) and @list.eql?(other.list)
end

def hash

@returns [Integer] The hash value based on the list.
Compute the hash value for this paths list.
def hash
	@list.hash
end

def initialize(list, roots = nil)

@parameter roots [Array(Path) | Nil] The root paths, if known.
@parameter list [Array] The array of paths.
Initialize a paths list.
def initialize(list, roots = nil)
	@list = Array(list).freeze
	@roots = roots
end

def inspect

@returns [String] A debug string showing the paths.
Generate a string representation for debugging.
def inspect
	"<Paths #{@list.inspect}>"
end

def roots

The list of roots for a given list of immutable files is also immutable, so we cache it for performance:
def roots
	@roots ||= super
end

def to_paths

@returns [Paths] Self.
Return this paths list unchanged.
def to_paths
	self
end