Sha256: 7538a3f712d8358c8d606c2d77c760521685f052916cec4156659b726987ef97

Contents?: true

Size: 704 Bytes

Versions: 2

Compression:

Stored size: 704 Bytes

Contents

# frozen_string_literal: true

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"]
          @seconds = payload["Seconds"].to_i

          @input_path  = Path.new(payload.fetch("InputPath", "$"))
          @output_path = Path.new(payload.fetch("OutputPath", "$"))
        end

        def run!(input)
          input = input_path.value(context, input)
          sleep(seconds)
          output = output_path.value(context, input)
          [@next, output]
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
floe-0.2.3 lib/floe/workflow/states/wait.rb
floe-0.2.2 lib/floe/workflow/states/wait.rb