Class: RailsSimpleEventSourcing::EventApplicator

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_simple_event_sourcing/event_applicator.rb

Instance Method Summary collapse

Constructor Details

#initialize(event) ⇒ EventApplicator

Returns a new instance of EventApplicator.



5
6
7
# File 'lib/rails_simple_event_sourcing/event_applicator.rb', line 5

def initialize(event)
  @event = event
end

Instance Method Details

#apply_to_aggregate(aggregate) ⇒ Object



9
10
11
12
13
# File 'lib/rails_simple_event_sourcing/event_applicator.rb', line 9

def apply_to_aggregate(aggregate)
  enable_aggregate_writes(aggregate)
  replay_history_if_needed(aggregate)
  apply_current_event(aggregate)
end