Class: Sequent::Util::DryRun::EventStoreProxy
- Inherits:
-
Object
- Object
- Sequent::Util::DryRun::EventStoreProxy
- Defined in:
- lib/sequent/util/dry_run.rb
Overview
Proxies the given EventStore implements commit_events that instead of publish and store just publishes the events.
Instance Attribute Summary collapse
-
#command_with_events ⇒ Object
readonly
Returns the value of attribute command_with_events.
-
#event_store ⇒ Object
readonly
Returns the value of attribute event_store.
Instance Method Summary collapse
- #commit_events(command, streams_with_events) ⇒ Object
-
#initialize(result) ⇒ EventStoreProxy
constructor
A new instance of EventStoreProxy.
Constructor Details
#initialize(result) ⇒ EventStoreProxy
Returns a new instance of EventStoreProxy.
41 42 43 44 45 |
# File 'lib/sequent/util/dry_run.rb', line 41 def initialize(result) @event_store = Sequent::Test::CommandHandlerHelpers::FakeEventStore.new @command_with_events = {} @result = result end |
Instance Attribute Details
#command_with_events ⇒ Object (readonly)
Returns the value of attribute command_with_events.
33 34 35 |
# File 'lib/sequent/util/dry_run.rb', line 33 def command_with_events @command_with_events end |
#event_store ⇒ Object (readonly)
Returns the value of attribute event_store.
33 34 35 |
# File 'lib/sequent/util/dry_run.rb', line 33 def event_store @event_store end |
Instance Method Details
#commit_events(command, streams_with_events) ⇒ Object
47 48 49 50 51 52 |
# File 'lib/sequent/util/dry_run.rb', line 47 def commit_events(command, streams_with_events) event_store.commit_events(command, streams_with_events) new_events = streams_with_events.flat_map { |_, events| events } @result.published_command_with_events(command, new_events) end |