Class: Build::Files::Paths
- Inherits:
-
List
- Object
- List
- Build::Files::Paths
show all
- Defined in:
- lib/build/files/paths.rb
Constant Summary
Constants inherited
from List
List::NONE
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from List
#+, #-, #==, coerce, #create, #delete, #exist?, #intersects?, #map, #rebase, #to_s, #touch, #with
Constructor Details
#initialize(list, roots = nil) ⇒ Paths
Returns a new instance of Paths.
26
27
28
29
|
# File 'lib/build/files/paths.rb', line 26
def initialize(list, roots = nil)
@list = Array(list).freeze
@roots = roots
end
|
Instance Attribute Details
#list ⇒ Object
Returns the value of attribute list.
31
32
33
|
# File 'lib/build/files/paths.rb', line 31
def list
@list
end
|
Class Method Details
.directory(root, relative_paths) ⇒ Object
64
65
66
67
68
69
70
|
# 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
|
Instance Method Details
#count ⇒ Object
38
39
40
|
# File 'lib/build/files/paths.rb', line 38
def count
@list.count
end
|
#each ⇒ Object
42
43
44
45
46
|
# 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) ⇒ Boolean
48
49
50
|
# File 'lib/build/files/paths.rb', line 48
def eql?(other)
self.class.eql?(other.class) and @list.eql?(other.list)
end
|
#hash ⇒ Object
52
53
54
|
# File 'lib/build/files/paths.rb', line 52
def hash
@list.hash
end
|
#inspect ⇒ Object
60
61
62
|
# File 'lib/build/files/paths.rb', line 60
def inspect
"<Paths #{@list.inspect}>"
end
|
#roots ⇒ Object
The list of roots for a given list of immutable files is also immutable, so we cache it for performance:
34
35
36
|
# File 'lib/build/files/paths.rb', line 34
def roots
@roots ||= super
end
|
#to_paths ⇒ Object
56
57
58
|
# File 'lib/build/files/paths.rb', line 56
def to_paths
self
end
|