module EventSourcing::Aggregate

Constants

Message

Public Class Methods

included(base) click to toggle source
# File lib/event_sourcing/aggregate.rb, line 5
def self.included(base)
  base.const_set("Actor", EventSourcing::Aggregate::Actor.for(base))
  base.extend ClassMethods
end
new(events = []) click to toggle source
# File lib/event_sourcing/aggregate.rb, line 10
def initialize(events = [])
  events.each do |e|
    _apply(e)
  end
end

Public Instance Methods

_apply(e) click to toggle source
# File lib/event_sourcing/aggregate.rb, line 16
def _apply(e)
  if respond_to?("apply_#{e}")
    send("apply_#{e}", e)
  else
    raise "unsupported event #{e}"
  end
end