Module: Lieutenant::Projection

Defined in:
lib/lieutenant/projection.rb

Overview

Projection helper. Allows clean syntax to subscribe to events:

module FooProjection
  include Lieutenant::Projection

  on(CreatedBarEvent) do |event|
     # ...
  end
end

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



14
15
16
17
18
# File 'lib/lieutenant/projection.rb', line 14

def self.included(base)
  base.class_eval do
    extend Lieutenant::Projection
  end
end

Instance Method Details

#on(*event_classes, &block) ⇒ Object

:reek:UtilityFunction



21
22
23
# File 'lib/lieutenant/projection.rb', line 21

def on(*event_classes, &block)
  Lieutenant.config.event_bus.subscribe(*event_classes, &block)
end