Module: EventSorcerer::NoUnitOfWork

Extended by:
Uber::Delegates
Defined in:
lib/event_sorcerer/no_unit_of_work.rb

Overview

Public: Handles the API of a UnitOfWork but does nothing.

Class Method Summary collapse

Class Method Details

.fetch_aggregate(_type, _id) ⇒ Object

Public: Returns nil.



11
12
13
# File 'lib/event_sorcerer/no_unit_of_work.rb', line 11

def fetch_aggregate(_type, _id)
  nil
end

.handle_save(save) ⇒ Object

Public: Immediately calls the save proc and publishes the reciepts via

the message bus.

save - the Proc object representing the save process.

Returns self.



21
22
23
24
25
26
27
# File 'lib/event_sorcerer/no_unit_of_work.rb', line 21

def handle_save(save)
  reciept = save.call
  message_bus.publish_events(reciept.id, reciept.klass, reciept.events,
                             reciept.meta)

  self
end

.store_aggregate(_aggregate) ⇒ Object

Public: Returns self.



30
31
32
# File 'lib/event_sorcerer/no_unit_of_work.rb', line 30

def store_aggregate(_aggregate)
  self
end