Class: ProgressMonitor::Display::MessageLoop
- Inherits:
-
Object
- Object
- ProgressMonitor::Display::MessageLoop
- Defined in:
- lib/progress_monitor/display/message_loop.rb
Instance Attribute Summary collapse
-
#main_thread ⇒ Object
readonly
Returns the value of attribute main_thread.
-
#queue ⇒ Object
readonly
Returns the value of attribute queue.
-
#renderer ⇒ Object
readonly
Returns the value of attribute renderer.
Instance Method Summary collapse
-
#initialize(queue, main_thread, renderer) ⇒ MessageLoop
constructor
A new instance of MessageLoop.
- #perform ⇒ Object
Constructor Details
#initialize(queue, main_thread, renderer) ⇒ MessageLoop
Returns a new instance of MessageLoop.
6 7 8 9 10 |
# File 'lib/progress_monitor/display/message_loop.rb', line 6 def initialize(queue, main_thread, renderer) @queue = queue @main_thread = main_thread @renderer = renderer end |
Instance Attribute Details
#main_thread ⇒ Object (readonly)
Returns the value of attribute main_thread.
4 5 6 |
# File 'lib/progress_monitor/display/message_loop.rb', line 4 def main_thread @main_thread end |
#queue ⇒ Object (readonly)
Returns the value of attribute queue.
4 5 6 |
# File 'lib/progress_monitor/display/message_loop.rb', line 4 def queue @queue end |
#renderer ⇒ Object (readonly)
Returns the value of attribute renderer.
4 5 6 |
# File 'lib/progress_monitor/display/message_loop.rb', line 4 def renderer @renderer end |
Instance Method Details
#perform ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/progress_monitor/display/message_loop.rb', line 12 def perform loop do = queue.pop case [:type] when :update on_update([:task], [:event], [:details]) when :timer on_timer when :input on_input [:key] end end rescue => error main_thread.raise error end |