Class: RailsSimpleEventSourcing::Event

Inherits:
ApplicationRecord
  • Object
show all
Includes:
AggregateConfiguration, EventAttributes, ReadOnly
Defined in:
app/models/rails_simple_event_sourcing/event.rb

Instance Method Summary collapse

Methods included from AggregateConfiguration

#aggregate_class, #aggregate_defined?

Instance Method Details

#apply(aggregate) ⇒ Object



22
23
24
25
26
# File 'app/models/rails_simple_event_sourcing/event.rb', line 22

def apply(aggregate)
  payload.each do |key, value|
    aggregate.send("#{key}=", value) if aggregate.respond_to?("#{key}=")
  end
end