Class: ActiveProjection::ProjectionTypeRegistry
- Inherits:
-
Object
- Object
- ActiveProjection::ProjectionTypeRegistry
- Includes:
- Singleton
- Defined in:
- lib/active_projection/projection_type_registry.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.process(headers, event) ⇒ Object
11 12 13 |
# File 'lib/active_projection/projection_type_registry.rb', line 11 def self.process(headers, event) instance.process headers, event end |
.register(projection) ⇒ Object
7 8 9 |
# File 'lib/active_projection/projection_type_registry.rb', line 7 def self.register(projection) self.registry << projection end |
.sync_projections ⇒ Object
23 24 25 |
# File 'lib/active_projection/projection_type_registry.rb', line 23 def self.sync_projections instance.sync_projections end |
Instance Method Details
#process(headers, event) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/active_projection/projection_type_registry.rb', line 15 def process(headers, event) projections.each do |projection| ActiveRecord::Base.transaction do projection.invoke(event, headers) if projection.evaluate headers end end end |
#sync_projections ⇒ Object
27 28 29 30 31 |
# File 'lib/active_projection/projection_type_registry.rb', line 27 def sync_projections projections.each do |projection| ProjectionRepository.create_or_get(projection.class.name) end end |