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, EventSourcing::CountingEventStream
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
43 44 45 46 47 |
# File 'lib/synapse/domain/stream.rb', line 43 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? true end |
#next_event ⇒ DomainEventMessage
Returns the next event in the stream and moves the stream’s pointer forward
31 |
# File 'lib/synapse/domain/stream.rb', line 31 def next_event; end |
#peek ⇒ DomainEventMessage
Returns the next event in the stream without moving the stream’s pointer forward
37 |
# File 'lib/synapse/domain/stream.rb', line 37 def peek; end |
#to_a ⇒ Array<DomainEventMessage>
Returns the domain events in this stream as an array
51 52 53 54 55 56 57 58 |
# File 'lib/synapse/domain/stream.rb', line 51 def to_a events = Array.new each do |event| events.push event end events end |