class RubyEventStore::SpecificationReader
Used for fetching events based on given query specification.
Attributes
mapper[R]
repository[R]
Public Class Methods
new(repository, mapper)
click to toggle source
@api private @private
# File lib/ruby_event_store/specification_reader.rb, line 8 def initialize(repository, mapper) @repository = repository @mapper = mapper end
Public Instance Methods
count(specification_result)
click to toggle source
@api private @private
# File lib/ruby_event_store/specification_reader.rb, line 28 def count(specification_result) repository.count(specification_result) end
each(specification_result) { |map { |record| record_to_event}| ... }
click to toggle source
@api private @private
# File lib/ruby_event_store/specification_reader.rb, line 22 def each(specification_result) repository.read(specification_result).each { |batch| yield batch.map { |record| mapper.record_to_event(record) } } end
one(specification_result)
click to toggle source
@api private @private
# File lib/ruby_event_store/specification_reader.rb, line 15 def one(specification_result) record = repository.read(specification_result) mapper.record_to_event(record) if record end