Class: Ad::AgentArchitecture::Dsl::WorkflowDsl
- Inherits:
-
Object
- Object
- Ad::AgentArchitecture::Dsl::WorkflowDsl
show all
- Includes:
- DataAccessors
- Defined in:
- lib/ad/agent_architecture/dsl/workflow_dsl.rb
Overview
This class is responsible for defining the workflow DSL
Instance Attribute Summary collapse
Instance Method Summary
collapse
#get_attribute, #get_prompt, #get_setting, #prompt_content, #sections, #setting_value
Constructor Details
#initialize(name, description: nil) ⇒ WorkflowDsl
Returns a new instance of WorkflowDsl.
12
13
14
15
|
# File 'lib/ad/agent_architecture/dsl/workflow_dsl.rb', line 12
def initialize(name, description: nil)
@data = { name: name, description: description, sections: [], attributes: {}, prompts: {}, settings: {} }
@current_section_order = 1
end
|
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
10
11
12
|
# File 'lib/ad/agent_architecture/dsl/workflow_dsl.rb', line 10
def data
@data
end
|
Instance Method Details
#attributes(&block) ⇒ Object
28
29
30
31
32
|
# File 'lib/ad/agent_architecture/dsl/workflow_dsl.rb', line 28
def attributes(&block)
dsl = AttributeDsl.new(self)
dsl.instance_eval(&block) if block_given?
dsl
end
|
#description(description) ⇒ Object
17
18
19
20
|
# File 'lib/ad/agent_architecture/dsl/workflow_dsl.rb', line 17
def description(description)
@data[:description] = description
self
end
|
#prompts(&block) ⇒ Object
34
35
36
37
38
|
# File 'lib/ad/agent_architecture/dsl/workflow_dsl.rb', line 34
def prompts(&block)
dsl = PromptDsl.new(self)
dsl.instance_eval(&block) if block_given?
dsl
end
|
#section(name, description: nil, &block) ⇒ Object
40
41
42
43
44
45
|
# File 'lib/ad/agent_architecture/dsl/workflow_dsl.rb', line 40
def section(name, description: nil, &block)
dsl = SectionDsl.new(self, name, @current_section_order, description: description)
@current_section_order += 1
dsl.instance_eval(&block) if block_given?
dsl
end
|
#settings(&block) ⇒ Object
22
23
24
25
26
|
# File 'lib/ad/agent_architecture/dsl/workflow_dsl.rb', line 22
def settings(&block)
dsl = SettingsDsl.new(self)
dsl.instance_eval(&block) if block_given?
dsl
end
|