Class: RubyEventStore::LinkByEventType

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_event_store/link_by_metadata.rb

Instance Method Summary collapse

Constructor Details

#initialize(event_store:, prefix: nil) ⇒ LinkByEventType

Returns a new instance of LinkByEventType.



31
32
33
34
# File 'lib/ruby_event_store/link_by_metadata.rb', line 31

def initialize(event_store:, prefix: nil)
  @event_store = event_store
  @prefix = prefix || "$by_type_"
end

Instance Method Details

#call(event) ⇒ Object



36
37
38
# File 'lib/ruby_event_store/link_by_metadata.rb', line 36

def call(event)
  @event_store.link([event.event_id], stream_name: "#{@prefix}#{event.event_type}")
end