Class: Glottis::Handlers::ConsoleInputHandler
- Inherits:
-
Object
- Object
- Glottis::Handlers::ConsoleInputHandler
- Defined in:
- lib/glottis/handlers/console_input_handler.rb
Overview
Holds a reference to the outgoing message queue and posts console input.
Constant Summary collapse
- USER_PROMPT =
'> '
Instance Method Summary collapse
- #cleanup ⇒ Object
-
#initialize(outgoing) ⇒ ConsoleInputHandler
constructor
A new instance of ConsoleInputHandler.
- #join ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(outgoing) ⇒ ConsoleInputHandler
Returns a new instance of ConsoleInputHandler.
12 13 14 15 16 |
# File 'lib/glottis/handlers/console_input_handler.rb', line 12 def initialize(outgoing) @outgoing = outgoing @running = false @thread = nil end |
Instance Method Details
#cleanup ⇒ Object
28 29 30 31 |
# File 'lib/glottis/handlers/console_input_handler.rb', line 28 def cleanup @running = false @thread&.kill if @thread&.alive? end |
#join ⇒ Object
24 25 26 |
# File 'lib/glottis/handlers/console_input_handler.rb', line 24 def join @thread&.join end |
#start ⇒ Object
18 19 20 21 22 |
# File 'lib/glottis/handlers/console_input_handler.rb', line 18 def start @running = true @thread = Thread.new { run_loop } self end |