Class: VimMate::ListedFile
- Inherits:
-
Object
- Object
- VimMate::ListedFile
- Defined in:
- lib/vimmatelib/files.rb
Overview
A file within the tree
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#icon ⇒ Object
Returns the icon for this file.
-
#icon_type ⇒ Object
The type of icon to use.
-
#initialize(path, parent = nil, &block) ⇒ ListedFile
constructor
Create a ListedFile from a path and an optional parent.
-
#refresh ⇒ Object
Refresh the file.
-
#status_text ⇒ Object
Returns the status text for this file.
Constructor Details
#initialize(path, parent = nil, &block) ⇒ ListedFile
Create a ListedFile from a path and an optional parent. A block must be passed so it can be called to signal changes.
36 37 38 39 40 41 42 43 |
# File 'lib/vimmatelib/files.rb', line 36 def initialize(path, parent = nil, &block) @path = path @name = File.basename(path) @parent = parent @tree_signal = block @tree_signal.call(:add, self) @last_status = nil end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
32 33 34 |
# File 'lib/vimmatelib/files.rb', line 32 def name @name end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
32 33 34 |
# File 'lib/vimmatelib/files.rb', line 32 def parent @parent end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
32 33 34 |
# File 'lib/vimmatelib/files.rb', line 32 def path @path end |
Instance Method Details
#icon ⇒ Object
Returns the icon for this file
52 53 54 |
# File 'lib/vimmatelib/files.rb', line 52 def icon Icons.file_icon end |
#icon_type ⇒ Object
The type of icon to use
103 104 105 |
# File 'lib/vimmatelib/files.rb', line 103 def icon_type :file end |
#refresh ⇒ Object
Refresh the file. Doesn’t do anything since it’s the directory that does the job.
47 48 49 |
# File 'lib/vimmatelib/files.rb', line 47 def refresh self end |
#status_text ⇒ Object
Returns the status text for this file
57 58 59 |
# File 'lib/vimmatelib/files.rb', line 57 def status_text "" end |