Class: Synapse::Domain::DomainEventStream Abstract
- Inherits:
-
Object
- Object
- Synapse::Domain::DomainEventStream
- Defined in:
- lib/synapse/domain/stream.rb
Overview
Represents a historical stream of domain events in chronological order
Direct Known Subclasses
SimpleDomainEventStream, EventSourcing::CapturingEventStream
Instance Method Summary collapse
-
#each {|DomainEventMessage| ... } ⇒ undefined
Yields the next domain events in the stream until the end of the stream has been reached.
-
#end? ⇒ Boolean
abstract
Returns true if the end of the stream has been reached.
-
#next_event ⇒ DomainEventMessage
abstract
Returns the next event in the stream and moves the stream’s pointer forward.
-
#peek ⇒ DomainEventMessage
abstract
Returns the next event in the stream without moving the stream’s pointer forward.
-
#to_a ⇒ Array<DomainEventMessage>
Returns the domain events in this stream as an array.
Instance Method Details
#each {|DomainEventMessage| ... } ⇒ undefined
Yields the next domain events in the stream until the end of the stream has been reached
47 48 49 50 51 |
# File 'lib/synapse/domain/stream.rb', line 47 def each until end? yield next_event end end |
#end? ⇒ Boolean
Returns true if the end of the stream has been reached
23 24 25 |
# File 'lib/synapse/domain/stream.rb', line 23 def end? raise NotImplementedError end |
#next_event ⇒ DomainEventMessage
Returns the next event in the stream and moves the stream’s pointer forward
31 32 33 |
# File 'lib/synapse/domain/stream.rb', line 31 def next_event raise NotImplementedError end |
#peek ⇒ DomainEventMessage
Returns the next event in the stream without moving the stream’s pointer forward
39 40 41 |
# File 'lib/synapse/domain/stream.rb', line 39 def peek raise NotImplementedError end |
#to_a ⇒ Array<DomainEventMessage>
Returns the domain events in this stream as an array
55 56 57 58 59 60 61 62 |
# File 'lib/synapse/domain/stream.rb', line 55 def to_a events = Array.new each do |event| events.push event end events end |