Class: Build::Files::List
- Inherits:
-
Object
- Object
- Build::Files::List
show all
- Includes:
- Enumerable
- Defined in:
- lib/build/files/list.rb
Overview
A list of paths, where #each yields instances of Path.
Constant Summary
collapse
- NONE =
Composite.new([]).freeze
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.coerce(arg) ⇒ Object
71
72
73
74
75
76
77
|
# File 'lib/build/files/list.rb', line 71
def self.coerce(arg)
if arg.kind_of? self
arg
else
Paths.new(arg)
end
end
|
Instance Method Details
#+(list) ⇒ Object
Create a composite list out of two other lists:
34
35
36
|
# File 'lib/build/files/list.rb', line 34
def +(list)
Composite.new([self, list])
end
|
#intersects?(other) ⇒ Boolean
Does this list of files include the path of any other?
39
40
41
|
# File 'lib/build/files/list.rb', line 39
def intersects? other
other.any?{|path| include?(path)}
end
|
#map ⇒ Object
67
68
69
|
# File 'lib/build/files/list.rb', line 67
def map
Paths.new(super)
end
|
#rebase(root) ⇒ Object
59
60
61
|
# File 'lib/build/files/list.rb', line 59
def rebase(root)
Paths.new(self.collect{|path| path.rebase(root)}, [root])
end
|
#roots ⇒ Object
29
30
31
|
# File 'lib/build/files/list.rb', line 29
def roots
collect{|path| path.root}.sort.uniq
end
|
#to_paths ⇒ Object
63
64
65
|
# File 'lib/build/files/list.rb', line 63
def to_paths
Paths.new(each.to_a)
end
|
#with(**args) ⇒ Object
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/build/files/list.rb', line 43
def with(**args)
return to_enum(:with, **args) unless block_given?
paths = []
each do |path|
updated_path = path.with(args)
yield path, updated_path
paths << updated_path
end
return Paths.new(paths)
end
|