Class: LanguageOperator::Dsl::Context
- Inherits:
-
Object
- Object
- LanguageOperator::Dsl::Context
- Includes:
- Helpers
- Defined in:
- lib/language_operator/dsl/context.rb
Overview
DSL context for defining tools
Provides the evaluation context for tool definition files. Tools are
defined using the tool method within this context.
Constant Summary collapse
- HTTP =
Provide access to HTTP and Shell helper classes as constants
LanguageOperator::Dsl::HTTP
- Shell =
LanguageOperator::Dsl::Shell
Instance Method Summary collapse
-
#initialize(registry) ⇒ Context
constructor
Initialize context with registry.
-
#tool(name) { ... } ⇒ void
Define a tool.
Methods included from Helpers
#env_get, #env_required, #error, #parse_csv, #run_command, #shell_escape, #success, #truncate, #validate_email, #validate_phone, #validate_url
Constructor Details
#initialize(registry) ⇒ Context
Initialize context with registry
34 35 36 |
# File 'lib/language_operator/dsl/context.rb', line 34 def initialize(registry) @registry = registry end |
Instance Method Details
#tool(name) { ... } ⇒ void
This method returns an undefined value.
Define a tool
43 44 45 46 47 |
# File 'lib/language_operator/dsl/context.rb', line 43 def tool(name, &) tool_def = ToolDefinition.new(name) tool_def.instance_eval(&) if block_given? @registry.register(tool_def) end |