Class: A2A::Agent::Handler

Inherits:
Object
  • Object
show all
Defined in:
lib/a2a/agent.rb

Overview

Internal handler object produced by the #on DSL method. Conforms to the Dispatcher duck-type: #operations, #call.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(agent:, operations:, block:) ⇒ Handler

Returns a new instance of Handler.



59
60
61
62
63
# File 'lib/a2a/agent.rb', line 59

def initialize(agent:, operations:, block:)
  @agent      = agent
  @operations = operations
  @block      = block
end

Instance Attribute Details

#operationsObject (readonly)

Returns the value of attribute operations.



57
58
59
# File 'lib/a2a/agent.rb', line 57

def operations
  @operations
end

Instance Method Details

#call(env) ⇒ Object



65
66
67
# File 'lib/a2a/agent.rb', line 65

def call(env)
  Context.new(env).execute(&@block)
end