Class: ListedFile
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
build, #hide!, #icon, #matches?, #message?, modify_icon, new_by_iter, new_by_reference, #reference, #reference=, #separator?, #to_s, #visible?
Constructor Details
#initialize(opts = {}) ⇒ ListedFile
Returns a new instance of ListedFile.
18
19
20
21
22
23
24
|
# File 'lib/listed_file.rb', line 18
def initialize(opts = {})
super
if fp = opts[:full_path]
self.full_path = fp
self.status = "normal" if VimMate::Config[:files_show_status]
end
end
|
Instance Attribute Details
#full_path ⇒ Object
Returns the value of attribute full_path.
2
3
4
|
# File 'lib/listed_file.rb', line 2
def full_path
@full_path
end
|
#name ⇒ Object
Returns the value of attribute name.
2
3
4
|
# File 'lib/listed_file.rb', line 2
def name
@name
end
|
#status ⇒ Object
Returns the value of attribute status.
2
3
4
|
# File 'lib/listed_file.rb', line 2
def status
@status
end
|
Class Method Details
.create(opts = {}) ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/listed_file.rb', line 4
def self.create(opts = {})
if fp = opts[:full_path]
if File.directory?(fp)
ListedDirectory.new opts
elsif File.file?(fp)
ListedFile.new opts
else
raise ArgumentError, "does not exist: #{fp}"
end
else
raise ArgumentError, "please give a :full_path, not only #{opts.inspect}"
end
end
|
Instance Method Details
#directory? ⇒ Boolean
48
49
50
|
# File 'lib/listed_file.rb', line 48
def directory?
false
end
|
#exists? ⇒ Boolean
51
52
53
|
# File 'lib/listed_file.rb', line 51
def exists?
full_path && ::File.file?(full_path)
end
|
#file? ⇒ Boolean
45
46
47
|
# File 'lib/listed_file.rb', line 45
def file?
true
end
|
#file_or_directory? ⇒ Boolean
54
55
56
|
# File 'lib/listed_file.rb', line 54
def file_or_directory?
file? || directory?
end
|
#icon_name ⇒ Object
25
26
27
|
# File 'lib/listed_file.rb', line 25
def icon_name
'file'
end
|
#show! ⇒ Object
58
59
60
61
62
63
64
|
# File 'lib/listed_file.rb', line 58
def show!
i = iter
while i = i.parent
i[VISIBLE] = true
end
super
end
|
#sort ⇒ Object
42
43
44
|
# File 'lib/listed_file.rb', line 42
def sort
"2-#{name}-1"
end
|