Sha256: d9ed82f805e4bf2c29d7139048c9c63416f3b718059275e92699bfc7eae53a50
Contents?: true
Size: 1.66 KB
Versions: 7
Compression:
Stored size: 1.66 KB
Contents
# frozen_string_literal: true require 'time' module Floe class Workflow module States class Wait < Floe::Workflow::State include NonTerminalMixin attr_reader :end, :input_path, :next, :seconds, :seconds_path, :timestamp, :timestamp_path, :output_path 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 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 => timestamp_path ? timestamp_path.value(context, input) : timestamp ) end def finish(context) input = input_path.value(context, context.input) context.output = output_path.value(context, input) super end def running?(context) waiting?(context) end def end? @end end private def validate_state!(workflow) validate_state_next!(workflow) end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems