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



16
17
18
# File 'lib/ruco/status_bar.rb', line 16

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

#formatObject



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

def format
  Curses::A_REVERSE
end

#viewObject



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

def view
  "Ruco #{Ruco::VERSION} -- #{@editor.file}#{change_indicator}#{writable_indicator}"
end

#writable_indicatorObject



20
21
22
23
24
25
# File 'lib/ruco/status_bar.rb', line 20

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