Class: Eventusha::CommandHandler

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command) ⇒ CommandHandler

Returns a new instance of CommandHandler.



5
6
7
# File 'lib/eventusha/command_handler.rb', line 5

def initialize(command)
  @command = command
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



3
4
5
# File 'lib/eventusha/command_handler.rb', line 3

def command
  @command
end

Class Method Details

.aggregate(aggregate_name) ⇒ Object



14
15
16
17
18
# File 'lib/eventusha/command_handler.rb', line 14

def self.aggregate(aggregate_name)
	define_method :aggregate do
    "Aggregates::#{aggregate_name.to_s.classify}".constantize
  end
end

.execute(command) ⇒ Object



9
10
11
12
# File 'lib/eventusha/command_handler.rb', line 9

def self.execute(command)
  handler = new(command)
  handler.execute
end