Sha256: 854ae1379fefed841c05e46396d2233def291db5169ed9f0f9f541cdb5e11197

Contents?: true

Size: 1.05 KB

Versions: 6

Compression:

Stored size: 1.05 KB

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: {}, settings: {} }
          @current_section_order = 1
        end

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

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

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

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ad-agent_architecture-0.0.17 lib/ad/agent_architecture/dsl/workflow_dsl.rb
ad-agent_architecture-0.0.16 lib/ad/agent_architecture/dsl/workflow_dsl.rb
ad-agent_architecture-0.0.15 lib/ad/agent_architecture/dsl/workflow_dsl.rb
ad-agent_architecture-0.0.14 lib/ad/agent_architecture/dsl/workflow_dsl.rb
ad-agent_architecture-0.0.13 lib/ad/agent_architecture/dsl/workflow_dsl.rb
ad-agent_architecture-0.0.12 lib/ad/agent_architecture/dsl/workflow_dsl.rb