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, #copy, #create, #delete, #empty?, #exist?, #intersects?, #map, #to_paths, #touch, #with
Constructor Details
#initialize(root) ⇒ Directory
Returns a new instance of Directory.
15
16
17
|
# File 'lib/build/files/directory.rb', line 15
def initialize(root)
@root = root
end
|
Class Method Details
.join(*args) ⇒ Object
11
12
13
|
# File 'lib/build/files/directory.rb', line 11
def self.join(*args)
self.new(Path.join(*args))
end
|
Instance Method Details
#each ⇒ Object
27
28
29
30
31
32
33
34
|
# File 'lib/build/files/directory.rb', line 27
def each
return to_enum(:each) unless block_given?
Dir.glob(@root + "**/{*,.?*}") do |path|
yield Path.new(path, @root)
end
end
|
#eql?(other) ⇒ Boolean
36
37
38
|
# File 'lib/build/files/directory.rb', line 36
def eql?(other)
self.class.eql?(other.class) and @root.eql?(other.root)
end
|
#hash ⇒ Object
40
41
42
|
# File 'lib/build/files/directory.rb', line 40
def hash
@root.hash
end
|
#include?(path) ⇒ Boolean
44
45
46
47
|
# File 'lib/build/files/directory.rb', line 44
def include?(path)
path.start_with?(@root)
end
|
#rebase(root) ⇒ Object
49
50
51
|
# File 'lib/build/files/directory.rb', line 49
def rebase(root)
self.class.new(@root.rebase(root))
end
|
#root ⇒ Object
19
20
21
|
# File 'lib/build/files/directory.rb', line 19
def root
@root
end
|
#roots ⇒ Object
23
24
25
|
# File 'lib/build/files/directory.rb', line 23
def roots
[root]
end
|
#to_path ⇒ Object
62
63
64
|
# File 'lib/build/files/directory.rb', line 62
def to_path
@root
end
|
#to_s ⇒ Object
58
59
60
|
# File 'lib/build/files/directory.rb', line 58
def to_s
to_str
end
|
#to_str ⇒ Object
Convert a Directory into a String, can be used as an argument to a command.
54
55
56
|
# File 'lib/build/files/directory.rb', line 54
def to_str
@root.to_str
end
|