class Build::Files::Paths

Attributes

list[R]

Public Class Methods

directory(root, relative_paths) click to toggle source
# File lib/build/files/paths.rb, line 64
def self.directory(root, relative_paths)
        paths = relative_paths.collect do |path|
                Path.join(root, path)
        end
        
        self.new(paths, [root])
end
new(list, roots = nil) click to toggle source
# File lib/build/files/paths.rb, line 26
def initialize(list, roots = nil)
        @list = Array(list).freeze
        @roots = roots
end

Public Instance Methods

count() click to toggle source
# File lib/build/files/paths.rb, line 38
def count
        @list.count
end
each() { |path| ... } click to toggle source
# File lib/build/files/paths.rb, line 42
def each
        return to_enum(:each) unless block_given?
        
        @list.each{|path| yield path}
end
eql?(other) click to toggle source
# File lib/build/files/paths.rb, line 48
def eql?(other)
        self.class.eql?(other.class) and @list.eql?(other.list)
end
hash() click to toggle source
# File lib/build/files/paths.rb, line 52
def hash
        @list.hash
end
inspect() click to toggle source
# File lib/build/files/paths.rb, line 60
def inspect
        "<Paths #{@list.inspect}>"
end
roots() click to toggle source

The list of roots for a given list of immutable files is also immutable, so we cache it for performance:

Calls superclass method Build::Files::List#roots
# File lib/build/files/paths.rb, line 34
def roots
        @roots ||= super
end
to_paths() click to toggle source
# File lib/build/files/paths.rb, line 56
def to_paths
        self
end