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
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from List
#+, #-, #==, coerce, #create, #delete, #exist?, #intersects?, #map, #to_paths, #touch, #with
Constructor Details
#initialize(root) ⇒ Directory
Returns a new instance of Directory.
30
31
32
|
# File 'lib/build/files/directory.rb', line 30
def initialize(root)
@root = root
end
|
Class Method Details
.join(*args) ⇒ Object
26
27
28
|
# File 'lib/build/files/directory.rb', line 26
def self.join(*args)
self.new(Path.join(*args))
end
|
Instance Method Details
#each ⇒ Object
42
43
44
45
46
47
48
49
|
# File 'lib/build/files/directory.rb', line 42
def each
return to_enum(:each) unless block_given?
Dir.glob(@root + "**/{*,.?*}") do |path|
yield Path.new(path, @root)
end
end
|
#eql?(other) ⇒ Boolean
51
52
53
|
# File 'lib/build/files/directory.rb', line 51
def eql?(other)
self.class.eql?(other.class) and @root.eql?(other.root)
end
|
#hash ⇒ Object
55
56
57
|
# File 'lib/build/files/directory.rb', line 55
def hash
@root.hash
end
|
#include?(path) ⇒ Boolean
59
60
61
62
|
# File 'lib/build/files/directory.rb', line 59
def include?(path)
path.start_with?(@root)
end
|
#rebase(root) ⇒ Object
64
65
66
|
# File 'lib/build/files/directory.rb', line 64
def rebase(root)
self.class.new(@root.rebase(root))
end
|
#root ⇒ Object
34
35
36
|
# File 'lib/build/files/directory.rb', line 34
def root
@root
end
|
#roots ⇒ Object
38
39
40
|
# File 'lib/build/files/directory.rb', line 38
def roots
[root]
end
|
#to_path ⇒ Object
77
78
79
|
# File 'lib/build/files/directory.rb', line 77
def to_path
@root
end
|
#to_s ⇒ Object
73
74
75
|
# File 'lib/build/files/directory.rb', line 73
def to_s
to_str
end
|
#to_str ⇒ Object
Convert a Directory into a String, can be used as an argument to a command.
69
70
71
|
# File 'lib/build/files/directory.rb', line 69
def to_str
@root.to_str
end
|