Class: Omnibot::Workflow::ExecutionContext

Inherits:
Object
  • Object
show all
Defined in:
lib/omnibot/workflow/runner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#inputObject (readonly)

Returns the value of attribute input.



148
149
150
# File 'lib/omnibot/workflow/runner.rb', line 148

def input
  @input
end

#runObject (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

#attemptsObject



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_againObject



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

#stateObject



157
# File 'lib/omnibot/workflow/runner.rb', line 157

def state = @state_proxy

#wait_for_inputObject



169
# File 'lib/omnibot/workflow/runner.rb', line 169

def wait_for_input = throw(INTERRUPT, :wait_input)