Class: Omnibot::Workflow::ExecutionContext
- Inherits:
-
Object
- Object
- Omnibot::Workflow::ExecutionContext
- Defined in:
- lib/omnibot/workflow/runner.rb
Instance Attribute Summary collapse
-
#input ⇒ Object
readonly
Returns the value of attribute input.
-
#run ⇒ Object
readonly
Returns the value of attribute run.
Instance Method Summary collapse
- #attempts ⇒ Object
- #handover!(reason: nil) ⇒ Object
-
#initialize(run, workflow, input) ⇒ ExecutionContext
constructor
A new instance of ExecutionContext.
- #poll_again ⇒ Object
- #reply(text) ⇒ Object
- #state ⇒ Object
- #wait_for_input ⇒ Object
Constructor Details
#initialize(run, workflow, input) ⇒ ExecutionContext
Returns a new instance of ExecutionContext.
150 151 152 153 154 155 |
# File 'lib/omnibot/workflow/runner.rb', line 150 def initialize(run, workflow, input) @run = run @workflow = workflow @input = input define_state_proxy end |
Instance Attribute Details
#input ⇒ Object (readonly)
Returns the value of attribute input.
148 149 150 |
# File 'lib/omnibot/workflow/runner.rb', line 148 def input @input end |
#run ⇒ Object (readonly)
Returns the value of attribute run.
148 149 150 |
# File 'lib/omnibot/workflow/runner.rb', line 148 def run @run end |
Instance Method Details
#attempts ⇒ Object
158 |
# File 'lib/omnibot/workflow/runner.rb', line 158 def attempts = @run.attempts |
#handover!(reason: nil) ⇒ Object
171 172 173 174 175 176 177 |
# File 'lib/omnibot/workflow/runner.rb', line 171 def handover!(reason: nil) ActiveSupport::Notifications.instrument( "omnibot.workflow.handover", workflow: @workflow, run_id: @run.id, step: @run.current_step, reason: reason ) throw(INTERRUPT, :handover) end |
#poll_again ⇒ Object
179 |
# File 'lib/omnibot/workflow/runner.rb', line 179 def poll_again = throw(INTERRUPT, :poll_again) |
#reply(text) ⇒ Object
160 161 162 163 164 165 166 167 |
# File 'lib/omnibot/workflow/runner.rb', line 160 def reply(text) @run.replies << text ActiveSupport::Notifications.instrument( "omnibot.workflow.reply", workflow: @workflow, run_id: @run.id, step: @run.current_step, text: text ) text end |
#state ⇒ Object
157 |
# File 'lib/omnibot/workflow/runner.rb', line 157 def state = @state_proxy |
#wait_for_input ⇒ Object
169 |
# File 'lib/omnibot/workflow/runner.rb', line 169 def wait_for_input = throw(INTERRUPT, :wait_input) |