Class: Build::Files::Directory
- Inherits:
-
List
- Object
- List
- Build::Files::Directory
show all
- Defined in:
- lib/build/files/directory.rb
Constant Summary
Constants inherited
from List
List::NONE
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from List
#+, coerce, #intersects?, #map, #to_paths, #with
Constructor Details
#initialize(root) ⇒ Directory
Returns a new instance of Directory.
26
27
28
29
|
# File 'lib/build/files/directory.rb', line 26
def initialize(root)
@root = root
@path = path
end
|
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
32
33
34
|
# File 'lib/build/files/directory.rb', line 32
def path
@path
end
|
#root ⇒ Object
Returns the value of attribute root.
31
32
33
|
# File 'lib/build/files/directory.rb', line 31
def root
@root
end
|
Instance Method Details
#each ⇒ Object
42
43
44
45
46
47
48
|
# File 'lib/build/files/directory.rb', line 42
def each
return to_enum(:each) unless block_given?
Dir.glob(full_path + "**/*") do |path|
yield Path.new(path, @root)
end
end
|
#eql?(other) ⇒ Boolean
50
51
52
|
# File 'lib/build/files/directory.rb', line 50
def eql?(other)
other.kind_of?(self.class) and @root.eql?(other.root) and @path.eql?(other.path)
end
|
#full_path ⇒ Object
38
39
40
|
# File 'lib/build/files/directory.rb', line 38
def full_path
Path.join(@root, @path)
end
|
#hash ⇒ Object
54
55
56
|
# File 'lib/build/files/directory.rb', line 54
def hash
[@root, @path].hash
end
|
#include?(path) ⇒ Boolean
58
59
60
61
|
# File 'lib/build/files/directory.rb', line 58
def include?(path)
path.start_with?(full_path)
end
|
#rebase(root) ⇒ Object
63
64
65
|
# File 'lib/build/files/directory.rb', line 63
def rebase(root)
self.class.new(root, @path)
end
|
#roots ⇒ Object
34
35
36
|
# File 'lib/build/files/directory.rb', line 34
def roots
[@root]
end
|