Sha256: 03a4a59b01fc070722ef8cc52168642c034b376d52705c2b4c6406c82a9e1011

Contents?: true

Size: 1.21 KB

Versions: 6

Compression:

Stored size: 1.21 KB

Contents

# frozen_string_literal: true

module Floe
  class Workflow
    module States
      class Pass < Floe::Workflow::State
        include InputOutputMixin
        include NonTerminalMixin

        attr_reader :end, :next, :result, :parameters, :input_path, :output_path, :result_path

        def initialize(workflow, name, payload)
          super

          @next        = payload["Next"]
          @end         = !!payload["End"]
          @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", "$"))

          validate_state!(workflow)
        end

        def finish(context)
          input = result.nil? ? process_input(context) : result
          context.output = process_output(context, input)
          super
        end

        def running?(_)
          false
        end

        def end?
          @end
        end

        private

        def validate_state!(workflow)
          validate_state_next!(workflow)
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
floe-0.15.1 lib/floe/workflow/states/pass.rb
floe-0.15.0 lib/floe/workflow/states/pass.rb
floe-0.14.0 lib/floe/workflow/states/pass.rb
floe-0.13.1 lib/floe/workflow/states/pass.rb
floe-0.13.0 lib/floe/workflow/states/pass.rb
floe-0.12.0 lib/floe/workflow/states/pass.rb