Class: Aggregates::CommandExecution

Inherits:
Object
  • Object
show all
Defined in:
lib/aggregates/command_execution.rb

Overview

Captures the execution of a command with the aggregate at its current state.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(aggregate_repo, command) ⇒ CommandExecution

Returns a new instance of CommandExecution.



8
9
10
11
# File 'lib/aggregates/command_execution.rb', line 8

def initialize(aggregate_repo, command)
  @aggregate_repo = aggregate_repo
  @command = command
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



6
7
8
# File 'lib/aggregates/command_execution.rb', line 6

def command
  @command
end

Instance Method Details

#aggregateObject



17
18
19
# File 'lib/aggregates/command_execution.rb', line 17

def aggregate
  command.load_related_aggregate(@aggregate_repo)
end

#execute_with(handler) ⇒ Object



13
14
15
# File 'lib/aggregates/command_execution.rb', line 13

def execute_with(handler)
  handler.invoke_handlers(command, aggregate)
end