Module: RubyLLM::MCP::Handlers::Concerns::Lifecycle
- Included in:
- ElicitationHandler, HumanInTheLoopHandler, SamplingHandler
- Defined in:
- lib/ruby_llm/mcp/handlers/concerns/lifecycle.rb
Overview
Provides lifecycle hook management (before_execute, after_execute) and orchestrates the execution flow
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
-
#call ⇒ Object
Main entry point - orchestrates hooks and execution.
-
#execute ⇒ Object
Abstract method - must be implemented by subclasses.
Class Method Details
.included(base) ⇒ Object
10 11 12 |
# File 'lib/ruby_llm/mcp/handlers/concerns/lifecycle.rb', line 10 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#call ⇒ Object
Main entry point - orchestrates hooks and execution
49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/ruby_llm/mcp/handlers/concerns/lifecycle.rb', line 49 def call # Execute before hooks execute_hooks(self.class.before_hooks) # Execute main logic result = execute # Execute after hooks execute_hooks(self.class.after_hooks, result) result end |
#execute ⇒ Object
Abstract method - must be implemented by subclasses
64 65 66 |
# File 'lib/ruby_llm/mcp/handlers/concerns/lifecycle.rb', line 64 def execute raise NotImplementedError, "#{self.class.name} must implement #execute" end |