Class: VimMate::ListedFile

Inherits:
Object
  • Object
show all
Defined in:
lib/vimmatelib/files.rb

Overview

A file within the tree

Direct Known Subclasses

ListedDirectory

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#nameObject (readonly)

Returns the value of attribute name.



32
33
34
# File 'lib/vimmatelib/files.rb', line 32

def name
  @name
end

#parentObject (readonly)

Returns the value of attribute parent.



32
33
34
# File 'lib/vimmatelib/files.rb', line 32

def parent
  @parent
end

#pathObject (readonly)

Returns the value of attribute path.



32
33
34
# File 'lib/vimmatelib/files.rb', line 32

def path
  @path
end

Instance Method Details

#iconObject

Returns the icon for this file



52
53
54
# File 'lib/vimmatelib/files.rb', line 52

def icon
  Icons.file_icon
end

#icon_typeObject

The type of icon to use



103
104
105
# File 'lib/vimmatelib/files.rb', line 103

def icon_type
  :file
end

#refreshObject

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_textObject

Returns the status text for this file



57
58
59
# File 'lib/vimmatelib/files.rb', line 57

def status_text
  ""
end