Class: Meshchat::Ui::CLI::Base

Inherits:
EventMachine::Connection
  • Object
show all
Defined in:
lib/meshchat/ui/cli/base.rb

Overview

this class, and all subclasses are Keyboard Handlers that are used for EventMachine’s open_keyboard

Direct Known Subclasses

KeyboardLineInput

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(input_receiver) ⇒ Base

Returns a new instance of Base.



14
15
16
17
# File 'lib/meshchat/ui/cli/base.rb', line 14

def initialize(input_receiver)
  @_input_receiver = input_receiver
  @_input_buffer = []
end

Instance Attribute Details

#_input_bufferObject (readonly)

An array of typed keystrokes



12
13
14
# File 'lib/meshchat/ui/cli/base.rb', line 12

def _input_buffer
  @_input_buffer
end

#_input_receiverObject (readonly)

The class used for interpeting the line input



10
11
12
# File 'lib/meshchat/ui/cli/base.rb', line 10

def _input_receiver
  @_input_receiver
end

Instance Method Details

#receive_data(data) ⇒ Object

Note:

that this method receives raw keystrokes by default and does not send data to the input receiver

override this method to alter how input is interpreted by the receiver.

hopefully, just by calling a different method on the receiver, as input processing shouldn’t occurr in this class or any subclass unless it is raw keystroke input



29
30
31
# File 'lib/meshchat/ui/cli/base.rb', line 29

def receive_data(data)
  _input_buffer.push(data)
end

#receive_line(line) ⇒ Object



33
34
35
# File 'lib/meshchat/ui/cli/base.rb', line 33

def receive_line(line)
  # only used when including EM::Protocols::LineText2
end