Module: Sandthorn::AggregateRootSnapshot
- Defined in:
- lib/sandthorn/aggregate_root_snapshot.rb
Instance Attribute Summary collapse
-
#aggregate_snapshot ⇒ Object
readonly
Returns the value of attribute aggregate_snapshot.
Instance Method Summary collapse
Instance Attribute Details
#aggregate_snapshot ⇒ Object (readonly)
Returns the value of attribute aggregate_snapshot.
3 4 5 |
# File 'lib/sandthorn/aggregate_root_snapshot.rb', line 3 def aggregate_snapshot @aggregate_snapshot end |
Instance Method Details
#aggregate_snapshot! ⇒ Object
11 12 13 14 15 16 |
# File 'lib/sandthorn/aggregate_root_snapshot.rb', line 11 def aggregate_snapshot! if @aggregate_events.count > 0 raise Errors::SnapshotError, "Can't take snapshot on object with unsaved events" end end |
#save_snapshot ⇒ Object
18 19 20 |
# File 'lib/sandthorn/aggregate_root_snapshot.rb', line 18 def save_snapshot Sandthorn.save_snapshot(self) end |
#snapshot ⇒ Object
5 6 7 8 9 |
# File 'lib/sandthorn/aggregate_root_snapshot.rb', line 5 def snapshot aggregate_snapshot! save_snapshot self end |