Class: Glottis::Handlers::ConsoleOutputHandler
- Inherits:
-
Object
- Object
- Glottis::Handlers::ConsoleOutputHandler
- Defined in:
- lib/glottis/handlers/console_output_handler.rb
Overview
Holds a reference to incoming message queue and prints messages to stdout.
Instance Method Summary collapse
- #cleanup ⇒ Object
-
#initialize(incoming) ⇒ ConsoleOutputHandler
constructor
A new instance of ConsoleOutputHandler.
- #join ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(incoming) ⇒ ConsoleOutputHandler
Returns a new instance of ConsoleOutputHandler.
7 8 9 10 11 |
# File 'lib/glottis/handlers/console_output_handler.rb', line 7 def initialize(incoming) @incoming = incoming @running = false @thread = nil end |
Instance Method Details
#cleanup ⇒ Object
23 24 25 26 |
# File 'lib/glottis/handlers/console_output_handler.rb', line 23 def cleanup @running = false @thread&.kill if @thread&.alive? end |
#join ⇒ Object
19 20 21 |
# File 'lib/glottis/handlers/console_output_handler.rb', line 19 def join @thread&.join end |
#start ⇒ Object
13 14 15 16 17 |
# File 'lib/glottis/handlers/console_output_handler.rb', line 13 def start @running = true @thread = Thread.new { run_loop } self end |