Class: Window

Inherits:
Object
  • Object
show all
Includes:
Curses
Defined in:
lib/backchannel/window.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Window

Returns a new instance of Window.



6
7
8
9
# File 'lib/backchannel/window.rb', line 6

def initialize(client)
  @client = client
  @messages = []
end

Instance Method Details

#new_message(message) ⇒ Object



24
25
26
27
# File 'lib/backchannel/window.rb', line 24

def new_message(message)
  @messages << message
  redraw
end

#startObject



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/backchannel/window.rb', line 11

def start
  init_screen
  start_color
  init_pair(COLOR_WHITE, COLOR_BLACK, COLOR_WHITE)
  redraw

  @client.add_message_listener(self)

  loop do
    capture_input
  end
end