Class: Build::Files::Difference
- Inherits:
-
List
- Object
- List
- Build::Files::Difference
show all
- Defined in:
- lib/build/files/difference.rb
Constant Summary
Constants inherited
from List
List::NONE
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from List
#+, #==, coerce, #create, #delete, #exist?, #intersects?, #map, #roots, #to_paths, #to_s, #touch, #with
Constructor Details
#initialize(list, excludes) ⇒ Difference
Returns a new instance of Difference.
26
27
28
29
|
# File 'lib/build/files/difference.rb', line 26
def initialize(list, excludes)
@list = list
@excludes = excludes
end
|
Instance Attribute Details
#files ⇒ Object
Returns the value of attribute files.
31
32
33
|
# File 'lib/build/files/difference.rb', line 31
def files
@files
end
|
Instance Method Details
#-(list) ⇒ Object
48
49
50
|
# File 'lib/build/files/difference.rb', line 48
def -(list)
self.class.new(@list, Composite.new(@excludes, list))
end
|
#each ⇒ Object
40
41
42
43
44
45
46
|
# File 'lib/build/files/difference.rb', line 40
def each
return to_enum(:each) unless block_given?
@list.each do |path|
yield path unless @excludes.include?(path)
end
end
|
#freeze ⇒ Object
33
34
35
36
37
38
|
# File 'lib/build/files/difference.rb', line 33
def freeze
@list.freeze
@excludes.freeze
super
end
|
#include?(path) ⇒ Boolean
52
53
54
|
# File 'lib/build/files/difference.rb', line 52
def include?(path)
@list.includes?(path) and !@excludes.include?(path)
end
|
#inspect ⇒ Object
60
61
62
|
# File 'lib/build/files/difference.rb', line 60
def inspect
"<Difference #{@files.inspect} - #{@excludes.inspect}>"
end
|
#rebase(root) ⇒ Object
56
57
58
|
# File 'lib/build/files/difference.rb', line 56
def rebase(root)
self.class.new(@files.collect{|list| list.rebase(root)}, [root])
end
|