Sha256: a9c04acd9ef9ac8bc15c73ff5a26287f8db5ee50b1d89c97a8af0dbd205e3aa6

Contents?: true

Size: 1.06 KB

Versions: 5

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true

module Ad
  module AgentArchitecture
    module Dsl
      # This class is responsible for defining the workflow DSL
      class WorkflowDsl
        include DataAccessors

        attr_reader :data

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

        def settings(&block)
          dsl = SettingsDsl.new(self)
          dsl.instance_eval(&block) if block_given?
          dsl
        end

        def attributes(&block)
          dsl = AttributeDsl.new(self)
          dsl.instance_eval(&block) if block_given?
          dsl
        end

        def prompts(&block)
          dsl = PromptDsl.new(self)
          dsl.instance_eval(&block) if block_given?
          dsl
        end

        def section(name, &block)
          dsl = SectionDsl.new(self, name, @current_section_order)
          @current_section_order += 1
          dsl.instance_eval(&block) if block_given?
          dsl
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ad-agent_architecture-0.0.22 lib/ad/agent_architecture/dsl/workflow_dsl.rb
ad-agent_architecture-0.0.21 lib/ad/agent_architecture/dsl/workflow_dsl.rb
ad-agent_architecture-0.0.20 lib/ad/agent_architecture/dsl/workflow_dsl.rb
ad-agent_architecture-0.0.19 lib/ad/agent_architecture/dsl/workflow_dsl.rb
ad-agent_architecture-0.0.18 lib/ad/agent_architecture/dsl/workflow_dsl.rb