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, #copy, #create, #delete, #empty?, #exist?, #intersects?, #map, #rebase, #to_s, #touch, #with
Constructor Details
#initialize(list, roots = nil) ⇒ Paths
Returns a new instance of Paths.
11
12
13
14
|
# File 'lib/build/files/paths.rb', line 11
def initialize(list, roots = nil)
@list = Array(list).freeze
@roots = roots
end
|
Instance Attribute Details
#list ⇒ Object
Returns the value of attribute list.
16
17
18
|
# File 'lib/build/files/paths.rb', line 16
def list
@list
end
|
Class Method Details
.directory(root, relative_paths) ⇒ Object
49
50
51
52
53
54
55
|
# File 'lib/build/files/paths.rb', line 49
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
23
24
25
|
# File 'lib/build/files/paths.rb', line 23
def count
@list.count
end
|
#each ⇒ Object
27
28
29
30
31
|
# File 'lib/build/files/paths.rb', line 27
def each
return to_enum(:each) unless block_given?
@list.each{|path| yield path}
end
|
#eql?(other) ⇒ Boolean
33
34
35
|
# File 'lib/build/files/paths.rb', line 33
def eql?(other)
self.class.eql?(other.class) and @list.eql?(other.list)
end
|
#hash ⇒ Object
37
38
39
|
# File 'lib/build/files/paths.rb', line 37
def hash
@list.hash
end
|
#inspect ⇒ Object
45
46
47
|
# File 'lib/build/files/paths.rb', line 45
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:
19
20
21
|
# File 'lib/build/files/paths.rb', line 19
def roots
@roots ||= super
end
|
#to_paths ⇒ Object
41
42
43
|
# File 'lib/build/files/paths.rb', line 41
def to_paths
self
end
|