Module: Support::Commands::CommandRunner

Defined in:
lib/hecks/domain/templates/lib/support/commands/command_runner.rb

Class Method Summary collapse

Class Method Details

.run(command, &block) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/hecks/domain/templates/lib/support/commands/command_runner.rb', line 4

def self.run(command, &block)
  Events::DomainEventPublisher.emit(
    const_get(command.class.to_s.split('::')[0])::
      Events::CommandWillRun.new(command)
  )

  command.call
  command.root.test_invariants(command)
  Events::DomainEventPublisher.emit(command, &block)
  command
end