Sha256: 56e1cd5ac195c0385bbdddbce68e2b4d0142b43d2e9e152ef3153ee6b5ceeee3
Contents?: true
Size: 928 Bytes
Versions: 2
Compression:
Stored size: 928 Bytes
Contents
# frozen_string_literal: true module Floe class Workflow module States class Choice < Floe::Workflow::State attr_reader :choices, :default, :input_path, :output_path def initialize(workflow, name, payload) super @choices = payload["Choices"].map { |choice| ChoiceRule.build(choice) } @default = payload["Default"] @input_path = Path.new(payload.fetch("InputPath", "$")) @output_path = Path.new(payload.fetch("OutputPath", "$")) end def run!(input) input = input_path.value(context, input) next_state = choices.detect { |choice| choice.true?(context, input) }&.next || default output = output_path.value(context, input) [next_state, output] end def status "running" end def end? false end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
floe-0.3.1 | lib/floe/workflow/states/choice.rb |
floe-0.3.0 | lib/floe/workflow/states/choice.rb |