Sha256: 17c9e3d1e49d2bbed7837265d32b145c293f821ad4416a4e7ffcfbdb0b826662

Contents?: true

Size: 1.08 KB

Versions: 4

Compression:

Stored size: 1.08 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)
          @step[:prompt] = prompt
        end

        private

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ad-agent_architecture-0.0.17 lib/ad/agent_architecture/dsl/step_dsl.rb
ad-agent_architecture-0.0.16 lib/ad/agent_architecture/dsl/step_dsl.rb
ad-agent_architecture-0.0.15 lib/ad/agent_architecture/dsl/step_dsl.rb
ad-agent_architecture-0.0.14 lib/ad/agent_architecture/dsl/step_dsl.rb