struct Athena::DependencyInjection::ServiceContainer
- Athena::DependencyInjection::ServiceContainer
- Struct
- Value
- Object
Overview
Where the instantiated services live.
A getter is defined for each service, if it is public. Otherwise, services are only available via constructor DI.
Defined in:
service_container.crConstructors
-
.new
Initializes the container.
Instance Method Summary
-
#get(type : Service.class)
Returns an array of services of the provided type.
-
#has?(name : String) : Bool
Returns
true
if a service with the provided name has been registered. -
#resolve(type : _, name : String) : ADI::Service
Returns the service of the given type and name.
-
#tagged(tag : String)
Returns services with the specified tag.
-
#tags : Hash(String, Array(String))
Mapping of tag name to services with that tag.
Constructor Detail
Instance Method Detail
def has?(name : String) : Bool
#
Returns true
if a service with the provided name has been registered.
def resolve(type : _, name : String) : ADI::Service
#
Returns the service of the given type and name.
Raises an exception if a service could not be resolved.