Class: ListedDirectory
Instance Attribute Summary
Attributes inherited from ListedFile
#full_path, #name, #status
Instance Method Summary
collapse
Methods inherited from ListedFile
create, #file_or_directory?, #initialize, #show!
build, #file_or_directory?, #hide!, #icon, #initialize, #matches?, #message?, modify_icon, new_by_iter, new_by_reference, #reference, #reference=, #separator?, #show!, #to_s, #visible?
Constructor Details
This class inherits a constructor from ListedFile
Instance Method Details
#add_new_files ⇒ Object
35
36
37
38
39
40
41
42
43
|
# File 'lib/listed_directory.rb', line 35
def add_new_files
begin
children_paths.each do |file_path|
tree << file_path
end
rescue Errno::ENOENT, Errno::EACCES
end
@traversed = true
end
|
#children_names ⇒ Object
29
30
31
|
# File 'lib/listed_directory.rb', line 29
def children_names
Dir.entries(full_path).select {|p| p !~ /^\./ }
end
|
#children_paths ⇒ Object
23
24
25
26
27
|
# File 'lib/listed_directory.rb', line 23
def children_paths
children_names.map {|n| File.join(full_path, n)}
rescue Errno::ENOENT, Errno::EACCES
[]
end
|
#directory? ⇒ Boolean
11
12
13
|
# File 'lib/listed_directory.rb', line 11
def directory?
true
end
|
#exists? ⇒ Boolean
14
15
16
|
# File 'lib/listed_directory.rb', line 14
def exists?
full_path && ::File.directory?(full_path)
end
|
#file? ⇒ Boolean
8
9
10
|
# File 'lib/listed_directory.rb', line 8
def file?
false end
|
#icon_name ⇒ Object
5
6
7
|
# File 'lib/listed_directory.rb', line 5
def icon_name
'folder'
end
|
#refresh ⇒ Object
17
18
19
20
21
|
# File 'lib/listed_directory.rb', line 17
def refresh
super
add_new_files
end
|
#sort ⇒ Object
2
3
4
|
# File 'lib/listed_directory.rb', line 2
def sort
"1-#{name}-1"
end
|