Class: Meshchat::Ui::CLI::Base
- Inherits:
-
EventMachine::Connection
- Object
- EventMachine::Connection
- Meshchat::Ui::CLI::Base
- 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
Instance Attribute Summary collapse
-
#_input_buffer ⇒ Object
readonly
An array of typed keystrokes.
-
#_input_receiver ⇒ Object
readonly
The class used for interpeting the line input.
Instance Method Summary collapse
-
#initialize(input_receiver) ⇒ Base
constructor
A new instance of Base.
-
#receive_data(data) ⇒ Object
override this method to alter how input is interpreted by the receiver.
- #receive_line(line) ⇒ Object
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_buffer ⇒ Object (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_receiver ⇒ Object (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 |