Class: Floe::Workflow::States::Wait
- Inherits:
-
Floe::Workflow::State
- Object
- Floe::Workflow::State
- Floe::Workflow::States::Wait
- Includes:
- NonTerminalMixin
- Defined in:
- lib/floe/workflow/states/wait.rb
Instance Attribute Summary collapse
-
#end ⇒ Object
readonly
Returns the value of attribute end.
-
#input_path ⇒ Object
readonly
Returns the value of attribute input_path.
-
#next ⇒ Object
readonly
Returns the value of attribute next.
-
#output_path ⇒ Object
readonly
Returns the value of attribute output_path.
-
#seconds ⇒ Object
readonly
Returns the value of attribute seconds.
-
#seconds_path ⇒ Object
readonly
Returns the value of attribute seconds_path.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
-
#timestamp_path ⇒ Object
readonly
Returns the value of attribute timestamp_path.
Attributes inherited from Floe::Workflow::State
#comment, #name, #payload, #type
Instance Method Summary collapse
- #end? ⇒ Boolean
- #finish(context) ⇒ Object
-
#initialize(workflow, name, payload) ⇒ Wait
constructor
A new instance of Wait.
- #running?(context) ⇒ Boolean
- #start(context) ⇒ Object
Methods included from NonTerminalMixin
Methods inherited from Floe::Workflow::State
build!, #finished?, #long_name, #mark_error, #mark_finished, #mark_started, #ready?, #run_nonblock!, #short_name, #started?, #wait, #wait_until, #waiting?
Methods included from ValidationMixin
included, #invalid_field_error!, #missing_field_error!, #parser_error!, #runtime_field_error!, #workflow_state?, #wrap_parser_error
Constructor Details
#initialize(workflow, name, payload) ⇒ Wait
Returns a new instance of Wait.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/floe/workflow/states/wait.rb', line 13 def initialize(workflow, name, payload) super @next = payload["Next"] @end = !!payload["End"] @seconds = payload["Seconds"]&.to_i @timestamp = payload["Timestamp"] @timestamp_path = Path.new(payload["TimestampPath"]) if payload.key?("TimestampPath") @seconds_path = Path.new(payload["SecondsPath"]) if payload.key?("SecondsPath") @input_path = Path.new(payload.fetch("InputPath", "$")) @output_path = Path.new(payload.fetch("OutputPath", "$")) validate_state!(workflow) end |
Instance Attribute Details
#end ⇒ Object (readonly)
Returns the value of attribute end.
11 12 13 |
# File 'lib/floe/workflow/states/wait.rb', line 11 def end @end end |
#input_path ⇒ Object (readonly)
Returns the value of attribute input_path.
11 12 13 |
# File 'lib/floe/workflow/states/wait.rb', line 11 def input_path @input_path end |
#next ⇒ Object (readonly)
Returns the value of attribute next.
11 12 13 |
# File 'lib/floe/workflow/states/wait.rb', line 11 def next @next end |
#output_path ⇒ Object (readonly)
Returns the value of attribute output_path.
11 12 13 |
# File 'lib/floe/workflow/states/wait.rb', line 11 def output_path @output_path end |
#seconds ⇒ Object (readonly)
Returns the value of attribute seconds.
11 12 13 |
# File 'lib/floe/workflow/states/wait.rb', line 11 def seconds @seconds end |
#seconds_path ⇒ Object (readonly)
Returns the value of attribute seconds_path.
11 12 13 |
# File 'lib/floe/workflow/states/wait.rb', line 11 def seconds_path @seconds_path end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
11 12 13 |
# File 'lib/floe/workflow/states/wait.rb', line 11 def @timestamp end |
#timestamp_path ⇒ Object (readonly)
Returns the value of attribute timestamp_path.
11 12 13 |
# File 'lib/floe/workflow/states/wait.rb', line 11 def @timestamp_path end |
Instance Method Details
#end? ⇒ Boolean
51 52 53 |
# File 'lib/floe/workflow/states/wait.rb', line 51 def end? @end end |
#finish(context) ⇒ Object
41 42 43 44 45 |
# File 'lib/floe/workflow/states/wait.rb', line 41 def finish(context) input = input_path.value(context, context.input) context.output = output_path.value(context, input) super end |
#running?(context) ⇒ Boolean
47 48 49 |
# File 'lib/floe/workflow/states/wait.rb', line 47 def running?(context) waiting?(context) end |
#start(context) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/floe/workflow/states/wait.rb', line 29 def start(context) super input = input_path.value(context, context.input) wait_until!( context, :seconds => seconds_path ? seconds_path.value(context, input).to_i : seconds, :time => ? .value(context, input) : ) end |