Class: RailsDomainModel::CommandHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_domain_model/command_handler.rb

Instance Method Summary collapse

Constructor Details

#initialize(command) ⇒ CommandHandler

Returns a new instance of CommandHandler.



2
3
4
# File 'lib/rails_domain_model/command_handler.rb', line 2

def initialize(command)
  @command = command
end

Instance Method Details

#handle!Object



6
7
8
9
10
# File 'lib/rails_domain_model/command_handler.rb', line 6

def handle!
  aggregate = aggregate_class.new._load(stream_name)
  aggregate.send(aggregate_method, @command)
  aggregate._store
end