Sha256: 2b4393cf0efeedc60ab5bc1c061b6a33f992777e753cabc4af86f3a2b2956826

Contents?: true

Size: 906 Bytes

Versions: 2

Compression:

Stored size: 906 Bytes

Contents

# frozen_string_literal: true

module Ad
  module AgentArchitecture
    module Dsl
      # This class is responsible for defining the workflow DSL
      class WorkflowDsl
        attr_reader :workflow

        def initialize(name)
          @workflow = { name: name, sections: [], attributes: {}, prompts: {} }
          @current_section_order = 1
        end

        def attributes(&block)
          dsl = AttributeDsl.new(@workflow[:attributes])
          dsl.instance_eval(&block) if block_given?
        end

        def prompts(&block)
          dsl = PromptDsl.new(@workflow[:prompts])
          dsl.instance_eval(&block) if block_given?
        end

        def section(name:, &block)
          dsl = SectionDsl.new(name, @current_section_order, @workflow[:sections])
          dsl.instance_eval(&block) if block_given?
          @current_section_order += 1
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ad-agent_architecture-0.0.11 lib/ad/agent_architecture/dsl/workflow_dsl.rb
ad-agent_architecture-0.0.10 lib/ad/agent_architecture/dsl/workflow_dsl.rb