module EventRegistry

Overview

The EventRegistry module is a registry for event classes. It allows event classes to register themselves with a unique identifier, and provides a factory method to create instances of these classes.

Defined in:

runway/models/base_event.cr

Class Method Summary

Class Method Detail

def self.create_event(event_type : String, event_config : Event, log : Log) : BaseEvent #

Creates an instance of an event class based on the event type.

@param event_type [String] The unique identifier for the event class. @param event_config [Event] The configuration for the event. @return [BaseEvent] The created event instance. @raise [RuntimeError] If the event type is unknown.


[View source]
def self.register_event(event_type : String, event_class : BaseEvent.class) #

Registers an event class with a unique identifier.

@param event_type [String] The unique identifier for the event class. @param event_class [BaseEvent.class] The event class to register.


[View source]