Class: Dire::Dir
Constant Summary
collapse
- @@invalid_link_handler =
-> (root, nodes, path) {}
- @@invalid_path_handler =
-> (root, nodes, path) {}
Instance Attribute Summary
Attributes inherited from Node
#path, #root
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Node
#get, #initialize, #parent, #to_s, #type
Constructor Details
This class inherits a constructor from Dire::Node
Class Method Details
.invalid_link_handler=(lambda) ⇒ Object
5
6
7
|
# File 'lib/dire/dir.rb', line 5
def self.invalid_link_handler= lambda
@@invalid_link_handler = lambda
end
|
.invalid_path_handler=(lambda) ⇒ Object
11
12
13
|
# File 'lib/dire/dir.rb', line 11
def self.invalid_path_handler= lambda
@@invalid_path_handler = lambda
end
|
Instance Method Details
#dirs ⇒ Object
15
16
17
|
# File 'lib/dire/dir.rb', line 15
def dirs
nodes.select { |i| i.absolute_path.directory? }
end
|
#files ⇒ Object
19
20
21
|
# File 'lib/dire/dir.rb', line 19
def files
nodes.select { |i| not i.absolute_path.directory? }
end
|
#list ⇒ Object
23
24
25
|
# File 'lib/dire/dir.rb', line 23
def list
dirs + files
end
|
#root? ⇒ Boolean
27
28
29
|
# File 'lib/dire/dir.rb', line 27
def root?
not parent
end
|
#validate! ⇒ Object
31
32
33
|
# File 'lib/dire/dir.rb', line 31
def validate!
super && validate_type!('directory')
end
|