Sha256: 571725ad3fcc1954867e0f7f941588df531e8bfbc9da5c417f7ca53d75e22cac
Contents?: true
Size: 1.41 KB
Versions: 2
Compression:
Stored size: 1.41 KB
Contents
# frozen_string_literal: true require 'time' module Floe class Workflow module States class Wait < Floe::Workflow::State attr_reader :end, :next, :seconds, :input_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", "$")) end def start(input) super input = input_path.value(context, input) context.output = output_path.value(context, input) context.next_state = end? ? nil : @next please_hold(input) end def running? waiting? end def end? @end end private def please_hold(input) wait( :seconds => @seconds_path ? @seconds_path.value(context, input).to_i : @seconds, :time => @timestamp_path ? @timestamp_path.value(context, input) : @timestamp ) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
floe-0.5.0 | lib/floe/workflow/states/wait.rb |
floe-0.4.1 | lib/floe/workflow/states/wait.rb |