Sha256: a737ae126e2d9b9aba28c66c039e2c9097195dba50cb4ee01ffb012469ebfea0

Contents?: true

Size: 956 Bytes

Versions: 2

Compression:

Stored size: 956 Bytes

Contents

# frozen_string_literal: true

module Floe
  class Workflow
    module States
      class Pass < Floe::Workflow::State
        attr_reader :end, :next, :result, :parameters, :input_path, :output_path, :result_path

        def initialize(workflow, name, payload)
          super

          @next        = payload["Next"]
          @result      = payload["Result"]

          @parameters  = PayloadTemplate.new(payload["Parameters"]) if payload["Parameters"]
          @input_path  = Path.new(payload.fetch("InputPath", "$"))
          @output_path = Path.new(payload.fetch("OutputPath", "$"))
          @result_path = ReferencePath.new(payload.fetch("ResultPath", "$"))
        end

        def run!(input)
          output = input_path.value(context, input)
          output = result_path.set(output, result) if result && result_path
          output = output_path.value(context, output)

          [@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/pass.rb
floe-0.2.2 lib/floe/workflow/states/pass.rb