Module: Lieutenant::Aggregate
- Defined in:
- lib/lieutenant/aggregate.rb
Overview
Representation of an aggregate root
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#uncommitted_events ⇒ Object
readonly
Returns the value of attribute uncommitted_events.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
37 38 39 |
# File 'lib/lieutenant/aggregate.rb', line 37 def id @id end |
#uncommitted_events ⇒ Object (readonly)
Returns the value of attribute uncommitted_events.
38 39 40 |
# File 'lib/lieutenant/aggregate.rb', line 38 def uncommitted_events @uncommitted_events end |
#version ⇒ Object
Returns the value of attribute version.
39 40 41 |
# File 'lib/lieutenant/aggregate.rb', line 39 def version @version end |
Class Method Details
.included(base) ⇒ Object
6 7 8 |
# File 'lib/lieutenant/aggregate.rb', line 6 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#mark_as_committed ⇒ Object
41 42 43 44 |
# File 'lib/lieutenant/aggregate.rb', line 41 def mark_as_committed self.version += uncommitted_events.size uncommitted_events.clear end |