Class: EventSourcery::EventProcessing::EventStreamProcessorRegistry
- Inherits:
-
Object
- Object
- EventSourcery::EventProcessing::EventStreamProcessorRegistry
- Defined in:
- lib/event_sourcery/event_processing/event_stream_processor_registry.rb
Instance Method Summary collapse
-
#all ⇒ Array
Returns an array of all the registered processors.
-
#by_type(constant) ⇒ ESProcess?
Find a registered processor by its type.
-
#find(processor_name) ⇒ ESProcess?
Find a registered processor by its name.
-
#initialize ⇒ EventStreamProcessorRegistry
constructor
A new instance of EventStreamProcessorRegistry.
-
#register(klass) ⇒ Object
Register the class of the Event Stream Processor.
Constructor Details
#initialize ⇒ EventStreamProcessorRegistry
Returns a new instance of EventStreamProcessorRegistry.
4 5 6 |
# File 'lib/event_sourcery/event_processing/event_stream_processor_registry.rb', line 4 def initialize @processors = [] end |
Instance Method Details
#all ⇒ Array
Returns an array of all the registered processors.
40 41 42 |
# File 'lib/event_sourcery/event_processing/event_stream_processor_registry.rb', line 40 def all @processors end |
#by_type(constant) ⇒ ESProcess?
Find a registered processor by its type.
31 32 33 34 35 |
# File 'lib/event_sourcery/event_processing/event_stream_processor_registry.rb', line 31 def by_type(constant) @processors.select do |processor| processor.included_modules.include?(constant) end end |
#find(processor_name) ⇒ ESProcess?
Find a registered processor by its name.
20 21 22 23 24 |
# File 'lib/event_sourcery/event_processing/event_stream_processor_registry.rb', line 20 def find(processor_name) @processors.find do |processor| processor.processor_name == processor_name end end |
#register(klass) ⇒ Object
Register the class of the Event Stream Processor.
11 12 13 |
# File 'lib/event_sourcery/event_processing/event_stream_processor_registry.rb', line 11 def register(klass) @processors << klass end |