class Aggro::EventProxy
Private: Used as a proxy to apply and save events to an aggregate.
Public Class Methods
new(aggregate, id)
click to toggle source
# File lib/aggro/event_proxy.rb, line 4 def initialize(aggregate, id) @aggregate = aggregate @id = id end
Public Instance Methods
method_missing(method_sym, *args)
click to toggle source
# File lib/aggro/event_proxy.rb, line 9 def method_missing(method_sym, *args) details = merge_details_with_command_context(args.pop || {}) event = Event.new(method_sym, Time.now, details) Aggro.store.write_single @id, event Aggro.event_bus.publish @id, event end
Private Instance Methods
merge_details_with_command_context(details)
click to toggle source
# File lib/aggro/event_proxy.rb, line 19 def merge_details_with_command_context(details) @aggregate.instance_variable_get(:@_context).merge(details) end