lib/colmena/domain.rb
# Apply a sequence of events to an entity
Apply a sequence of events to an entity
Apply a sequence of events to an entity
def apply(entity, events)
      events.reduce(entity) do |result, event|
        @event_handlers[event.fetch(:type)].call(result, event)
      end
    end
def apply ( entity , events ) events . reduce ( entity ) do | result , event | @event_handlers [ event . fetch ( :type ) ] . call ( result , event ) end end
Apply a sequence of events to an entity
Apply a sequence of events to an entity
entity
<not_specific>
events
<not_specific>