Class: Dcha::UI

Inherits:
Object
  • Object
show all
Includes:
Curses
Defined in:
lib/dcha/ui.rb,
lib/dcha/ui/window.rb

Overview

TODO: Implement ‘curses` ui :nodoc:

Defined Under Namespace

Classes: Window

Instance Method Summary collapse

Constructor Details

#initialize(peer) ⇒ UI

Returns a new instance of UI.



9
10
11
12
13
14
15
# File 'lib/dcha/ui.rb', line 9

def initialize(peer)
  @window = Window.new(0, 0, 0, 0)
  @peer = peer
  @logs = []
  @input = ''
  @peer.add_observer(self)
end

Instance Method Details

#showObject



17
18
19
20
21
22
23
24
# File 'lib/dcha/ui.rb', line 17

def show
  until @input == 'exit'
    parse
    refresh
    @input = @window.getstr
  end
  @window.close
end

#update(action, _, _params, time) ⇒ Object



26
27
28
29
# File 'lib/dcha/ui.rb', line 26

def update(action, _, _params, time)
  @logs.push("Execute #{action} at #{time}")
  refresh
end