Class: Teek::BackgroundNone::BackgroundWork::TaskContext Private
- Inherits:
-
Object
- Object
- Teek::BackgroundNone::BackgroundWork::TaskContext
- Defined in:
- lib/teek/background_none.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Synchronous task context - callbacks fire immediately
Instance Method Summary collapse
- #check_message ⇒ Object private
- #check_pause ⇒ Object private
-
#initialize(app, callbacks, message_queue) ⇒ TaskContext
constructor
private
A new instance of TaskContext.
- #send_message(msg) ⇒ Object private
- #wait_message ⇒ Object private
- #yield(value) ⇒ Object private
Constructor Details
#initialize(app, callbacks, message_queue) ⇒ TaskContext
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of TaskContext.
110 111 112 113 114 115 |
# File 'lib/teek/background_none.rb', line 110 def initialize(app, callbacks, ) @app = app @callbacks = callbacks @message_queue = @paused = false end |
Instance Method Details
#check_message ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
121 122 123 124 125 |
# File 'lib/teek/background_none.rb', line 121 def msg = @message_queue.shift (msg) if msg msg end |
#check_pause ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
135 136 137 138 139 140 141 |
# File 'lib/teek/background_none.rb', line 135 def check_pause while @paused @app.update msg = break unless @paused end end |
#send_message(msg) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
131 132 133 |
# File 'lib/teek/background_none.rb', line 131 def (msg) @callbacks[:message]&.call(msg) end |
#wait_message ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
127 128 129 |
# File 'lib/teek/background_none.rb', line 127 def end |
#yield(value) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
117 118 119 |
# File 'lib/teek/background_none.rb', line 117 def yield(value) @callbacks[:progress]&.call(value) end |