Class: Ruco::StatusBar

Inherits:
Object show all
Defined in:
lib/ruco/status_bar.rb

Instance Method Summary collapse

Constructor Details

#initialize(editor, options) ⇒ StatusBar

Returns a new instance of StatusBar.



3
4
5
6
# File 'lib/ruco/status_bar.rb', line 3

def initialize(editor, options)
  @editor = editor
  @options = options
end

Instance Method Details

#change_indicatorObject



13
14
15
# File 'lib/ruco/status_bar.rb', line 13

def change_indicator
  @editor.modified? ? '*' : ' '
end

#viewObject



8
9
10
11
# File 'lib/ruco/status_bar.rb', line 8

def view
  position = @editor.position
  spread "Ruco #{Ruco::VERSION} -- #{@editor.file}#{change_indicator}#{writable_indicator}", "#{position.line + 1}:#{position.column + 1}"
end

#writable_indicatorObject



17
18
19
20
21
22
# File 'lib/ruco/status_bar.rb', line 17

def writable_indicator
  @writable ||= begin
    writable = (not File.exist?(@editor.file) or system("test -w #{@editor.file}"))
    writable ? ' ' : '!'
  end
end