Class: RailsSimpleEventSourcing::CommandHandler
- Inherits:
-
Object
- Object
- RailsSimpleEventSourcing::CommandHandler
- Defined in:
- lib/rails_simple_event_sourcing/command_handler.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(command) ⇒ CommandHandler
constructor
A new instance of CommandHandler.
Constructor Details
#initialize(command) ⇒ CommandHandler
Returns a new instance of CommandHandler.
5 6 7 |
# File 'lib/rails_simple_event_sourcing/command_handler.rb', line 5 def initialize(command) @command = command end |
Instance Method Details
#call ⇒ Object
9 10 11 12 13 |
# File 'lib/rails_simple_event_sourcing/command_handler.rb', line 9 def call return Result.new(success?: false, errors: @command.errors) unless @command.valid? initialize_command_handler.call end |