class Eventusha::Command

Attributes

aggregate_id[RW]

Public Class Methods

attributes(*attributes) click to toggle source
# File lib/eventusha/command.rb, line 7
def self.attributes(*attributes)
        attr_accessor *attributes
        define_method :readable_attributes do
                attributes
        end
end

Public Instance Methods

attributes() click to toggle source
# File lib/eventusha/command.rb, line 25
def attributes
  readable_attributes.each_with_object({}) do |attribute, attrs_hash|
    attrs_hash[attribute] = instance_variable_get("@#{attribute}")
  end.with_indifferent_access
end
execute() click to toggle source
# File lib/eventusha/command.rb, line 14
def execute
  return false if invalid?

  command_handler = find_command_handler(self)
  command_handler.execute(self)
end
find_command_handler(command) click to toggle source
# File lib/eventusha/command.rb, line 21
def find_command_handler(command)
  "CommandHandlers::#{self.class.name.demodulize}".constantize
end