Module: AggregateRoot::Base

Defined in:
lib/aggregate_root/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#idObject

Returns the value of attribute id.



5
6
7
# File 'lib/aggregate_root/base.rb', line 5

def id
  @id
end

Instance Method Details

#apply(event) ⇒ Object



7
8
9
10
# File 'lib/aggregate_root/base.rb', line 7

def apply(event)
  apply_event(event)
  unpublished_events << event
end

#apply_old_event(event) ⇒ Object



12
13
14
# File 'lib/aggregate_root/base.rb', line 12

def apply_old_event(event)
  apply_event(event)
end

#unpublished_eventsObject



16
17
18
# File 'lib/aggregate_root/base.rb', line 16

def unpublished_events
  @unpublished_events ||= []
end