module

PointClickEngine::Core::Services

Global service configuration and access

Example usage:

# Initialize default services
Services.configure_defaults

# Access services
bus = Services.event_bus
bus.publish(SomeEvent.new)

# For testing, swap implementations
Services.registry.register_instance(EventBus, mock_bus)

Class methods

clear_scope

Clear scoped services (call between game sessions)

Source
configure_defaults

Configure default services Call this once during engine initialization

Source
configured?

Check if services have been configured

Source
event_bus

Convenience accessor for the event bus

Source
register(interface : T.class, lifetime : ServiceLifetime = ServiceLifetime::Singleton, &factory : ServiceRegistry -> T) forall T

Helper to register a custom service

Source
register_instance(interface : T.class, instance : T) forall T

Helper to register an instance

Source
registry

Get the global service registry

Source
reset

Reset all services (primarily for testing)

Source
resolve(interface : T.class) : T forall T

Helper to resolve a service

Source
resolve?(interface : T.class) : T | Nil forall T

Helper to try resolving a service

Source