Module: Synapse::EventSourcing::AggregateRoot::ClassMethods

Defined in:
lib/synapse/event_sourcing/aggregate_root.rb

Instance Method Summary collapse

Instance Method Details

#new_from_stream(stream) ⇒ AggregateRoot

Creates a new instance of this aggregate root without calling its initializer and initializes the state of the aggregate from the given event stream.

Parameters:

  • stream (DomainEventStream)

Returns:



115
116
117
118
119
# File 'lib/synapse/event_sourcing/aggregate_root.rb', line 115

def new_from_stream(stream)
  aggregate = allocate
  aggregate.initialize_from_stream stream
  aggregate
end