Class: Synapse::EventSourcing::CountingEventStream
Overview
Event stream decorator that simply counts each event that is retrieved from a delegate stream
Instance Method Summary
collapse
#each, #end?, #peek, #to_a
Constructor Details
#initialize(delegate, counter) ⇒ undefined
10
11
12
13
|
# File 'lib/synapse/event_sourcing/snapshot/count_stream.rb', line 10
def initialize(delegate, counter)
@delegate = delegate
@counter = counter
end
|
Instance Method Details
#next_event ⇒ DomainEventMessage
16
17
18
19
20
21
22
23
24
|
# File 'lib/synapse/event_sourcing/snapshot/count_stream.rb', line 16
def next_event
next_event = @delegate.next_event
@counter.update do |value|
value = value.next
end
next_event
end
|