PointClickEngine::Core::ServiceRegistry
Inherits Reference < Object
Service registry with automatic resolution
Example usage:
registry = ServiceRegistry.new
# Register with factory
registry.register(EventBus) do |r|
EventBus.new
end
# Register an existing instance
registry.register_instance(EventBus, my_event_bus)
# Resolve services
bus = registry.resolve(EventBus)
Constructors
new
SourceInstance methods
register(interface : T.class, lifetime : ServiceLifetime = ServiceLifetime::Singleton, &factory : ServiceRegistry -> T) forall T
Register a service with a factory
register_instance(interface : T.class, instance : T) forall T
Register an existing instance directly
resolve?(interface : T.class) : T | Nil forall T
Try to resolve a service, returning nil if not found