Di::Scope
Inherits Di::KeyParser < Reference < Object
A scope provides isolated provider registration with parent inheritance. Child scopes shadow parent providers without modifying them. Thread-safe for multi-threaded Crystal (-Dpreview_mt).
Constructors
Instance methods
Count implementations for an interface type across scope chain.
Remove a provider by key (used for rollback on partial registration failure).
Find all named interface providers matching ~Type:Impl:name across scope chain. Child shadows parent by ALIAS NAME, not by full key.
Find all named interface providers keyed for deduplication in child scopes.
Find a named interface provider, raising on ambiguity or not found.
Get a provider by key, raising ServiceNotFound if not in scope chain.
Get a provider by key, checking parent scope then fallback registry.
Get all providers for an interface type across scope chain. Child shadows parent by IMPL KEY (Type:Impl segment).
Get all providers keyed by full key for deduplication in child scopes.
Get implementation names for an interface type across scope chain.
Register a provider with the given key. Raises AlreadyRegistered if the key already exists in this scope.
Check if a provider is registered in this scope, parent, or fallback registry.