Class: A2A::Server::Env

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

Overview

Rack middleware that injects shared A2A context into the env.

Sets env so downstream middleware and handlers can access it without coupling to any particular configuration mechanism.

Instance Method Summary collapse

Constructor Details

#initialize(app, agent_card: {}) ⇒ Env

Returns a new instance of Env.



15
16
17
18
# File 'lib/a2a/server/env.rb', line 15

def initialize(app, agent_card: {})
  @app = app
  @agent_card = agent_card
end

Instance Method Details

#call(env) ⇒ Object



20
21
22
23
# File 'lib/a2a/server/env.rb', line 20

def call(env)
  env["a2a.agent_card"] = @agent_card
  @app.call(env)
end