Class: EventSourcing::Event::Stream
- Inherits:
-
Object
- Object
- EventSourcing::Event::Stream
- Includes:
- Enumerable
- Defined in:
- lib/event_sourcing/event/stream.rb
Instance Attribute Summary collapse
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #append(events) ⇒ Object
- #each(&block) ⇒ Object
-
#initialize(id, events, version, store) ⇒ Stream
constructor
A new instance of Stream.
Constructor Details
#initialize(id, events, version, store) ⇒ Stream
Returns a new instance of Stream.
7 8 9 10 11 12 |
# File 'lib/event_sourcing/event/stream.rb', line 7 def initialize(id, events, version, store) @id = id @events = events @version = version @store = store end |
Instance Attribute Details
#version ⇒ Object (readonly)
Returns the value of attribute version.
4 5 6 |
# File 'lib/event_sourcing/event/stream.rb', line 4 def version @version end |
Instance Method Details
#append(events) ⇒ Object
18 19 20 |
# File 'lib/event_sourcing/event/stream.rb', line 18 def append(events) @store.append(@id, @version, events) end |
#each(&block) ⇒ Object
14 15 16 |
# File 'lib/event_sourcing/event/stream.rb', line 14 def each(&block) @events.each(&block) end |