Class: RailsEventStore::Actions::AppendEventToStream
- Inherits:
-
Object
- Object
- RailsEventStore::Actions::AppendEventToStream
- Defined in:
- lib/rails_event_store/actions/append_event_to_stream.rb
Instance Method Summary collapse
- #call(stream_name, event, expected_version) ⇒ Object
-
#initialize(repository) ⇒ AppendEventToStream
constructor
A new instance of AppendEventToStream.
Constructor Details
#initialize(repository) ⇒ AppendEventToStream
Returns a new instance of AppendEventToStream.
5 6 7 |
# File 'lib/rails_event_store/actions/append_event_to_stream.rb', line 5 def initialize(repository) @repository = repository end |
Instance Method Details
#call(stream_name, event, expected_version) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/rails_event_store/actions/append_event_to_stream.rb', line 9 def call(stream_name, event, expected_version) raise WrongExpectedEventVersion if version_incorrect?(stream_name, expected_version) event.validate! save_event(event, stream_name) return event end |