Sha256: cefb0b0ef0b515a593ca69fdb3d1068bb5bf637909c7434c0c7f8a060878cb49

Contents?: true

Size: 1.13 KB

Versions: 2

Compression:

Stored size: 1.13 KB

Contents

# file: lib/ad/agent_architecture/dsl/step_dsl.rb

# frozen_string_literal: true

module Ad
  module AgentArchitecture
    module Dsl
      # This class is responsible for defining the steps of a section
      class StepDsl < ChildDsl
        attr_reader :section
        attr_reader :step

        def initialize(workflow, section, name, order)
          super(workflow)
          @step = {
            name: name,
            order: order,
            prompt: '',
            input_attributes: [],
            output_attributes: []
          }

          @section = section
          @section[:steps] << @step
        end

        def input(name, **_opts)
          infer_attribute(name)
          @step[:input_attributes] << name
        end

        def output(name, **_opts)
          infer_attribute(name)
          @step[:output_attributes] << name
        end

        def prompt(prompt, **_opts)
          # lookup_prompt = workflow.get_prompt(prompt)
          @step[:prompt] = prompt
        end

        private

        def infer_attribute(name)
          AttributeDsl.new(workflow).infer_attribute(name)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ad-agent_architecture-0.0.19 lib/ad/agent_architecture/dsl/step_dsl.rb
ad-agent_architecture-0.0.18 lib/ad/agent_architecture/dsl/step_dsl.rb