Module: EventSourcery::AggregateRoot::ClassMethods
- Defined in:
- lib/event_sourcery/aggregate_root.rb
Instance Attribute Summary collapse
-
#event_handlers ⇒ Object
readonly
Collection of event handlers for the events that this aggregate cares about.
Instance Method Summary collapse
-
#apply(*event_classes, &block) ⇒ Object
Register an event handler for the specified event(s).
Instance Attribute Details
#event_handlers ⇒ Object (readonly)
Collection of event handlers for the events that this aggregate cares about
66 67 68 |
# File 'lib/event_sourcery/aggregate_root.rb', line 66 def event_handlers @event_handlers end |
Instance Method Details
#apply(*event_classes, &block) ⇒ Object
Register an event handler for the specified event(s)
77 78 79 80 81 |
# File 'lib/event_sourcery/aggregate_root.rb', line 77 def apply(*event_classes, &block) event_classes.each do |event_class| @event_handlers[event_class.type] << block end end |