Class: Ad::AgentArchitecture::Dsl::StepDsl
- Defined in:
- lib/ad/agent_architecture/dsl/step_dsl.rb
Overview
This class is responsible for defining the steps of a section
Instance Attribute Summary collapse
-
#section ⇒ Object
readonly
Returns the value of attribute section.
-
#step ⇒ Object
readonly
Returns the value of attribute step.
Attributes inherited from ChildDsl
Instance Method Summary collapse
- #description(description) ⇒ Object
-
#initialize(workflow, section, name, order, description: nil) ⇒ StepDsl
constructor
A new instance of StepDsl.
- #input(name, **_opts) ⇒ Object
- #output(name, **_opts) ⇒ Object
- #prompt(prompt, **_opts) ⇒ Object
Methods inherited from ChildDsl
Methods included from DataAccessors
#attributes, #get_attribute, #get_prompt, #get_setting, #prompt_content, #prompts, #sections, #setting_value, #settings
Constructor Details
#initialize(workflow, section, name, order, description: nil) ⇒ StepDsl
Returns a new instance of StepDsl.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/ad/agent_architecture/dsl/step_dsl.rb', line 13 def initialize(workflow, section, name, order, description: nil) super(workflow) @step = { name: name, order: order, description: description, prompt: '', input_attributes: [], output_attributes: [] } @section = section @section[:steps] << @step end |
Instance Attribute Details
#section ⇒ Object (readonly)
Returns the value of attribute section.
10 11 12 |
# File 'lib/ad/agent_architecture/dsl/step_dsl.rb', line 10 def section @section end |
#step ⇒ Object (readonly)
Returns the value of attribute step.
11 12 13 |
# File 'lib/ad/agent_architecture/dsl/step_dsl.rb', line 11 def step @step end |
Instance Method Details
#description(description) ⇒ Object
46 47 48 49 |
# File 'lib/ad/agent_architecture/dsl/step_dsl.rb', line 46 def description(description) @step[:description] = description self end |
#input(name, **_opts) ⇒ Object
28 29 30 31 32 |
# File 'lib/ad/agent_architecture/dsl/step_dsl.rb', line 28 def input(name, **_opts) infer_attribute(name) @step[:input_attributes] << name self end |
#output(name, **_opts) ⇒ Object
34 35 36 37 38 |
# File 'lib/ad/agent_architecture/dsl/step_dsl.rb', line 34 def output(name, **_opts) infer_attribute(name) @step[:output_attributes] << name self end |
#prompt(prompt, **_opts) ⇒ Object
40 41 42 43 44 |
# File 'lib/ad/agent_architecture/dsl/step_dsl.rb', line 40 def prompt(prompt, **_opts) content = prompt_content(prompt) @step[:prompt] = content || prompt self end |