Class: Glottis::Handlers::ConsoleOutputHandler
- Inherits:
-
Thread
- Object
- Thread
- Glottis::Handlers::ConsoleOutputHandler
- Defined in:
- lib/glottis/handlers/console_output_handler.rb
Overview
This class holds a reference to the incoming message queue, and displays messages in the console as they are received.
Instance Method Summary collapse
- #cleanup ⇒ Object
-
#initialize(incoming) ⇒ ConsoleOutputHandler
constructor
A new instance of ConsoleOutputHandler.
Constructor Details
#initialize(incoming) ⇒ ConsoleOutputHandler
Returns a new instance of ConsoleOutputHandler.
6 7 8 9 10 11 12 13 14 |
# File 'lib/glottis/handlers/console_output_handler.rb', line 6 def initialize(incoming) @incoming = incoming super do loop do new_msg = @incoming.pop puts "#{new_msg['from']}, #{new_msg['to']}, #{new_msg['msg']}" end end end |
Instance Method Details
#cleanup ⇒ Object
16 17 18 |
# File 'lib/glottis/handlers/console_output_handler.rb', line 16 def cleanup puts '|' end |