Class: Synapse::Command::CommandMessage

Inherits:
Message
  • Object
show all
Defined in:
lib/synapse/command/message.rb

Overview

Represents an intent to change application state

Instance Attribute Summary

Attributes inherited from Message

#id, #metadata, #payload

Class Method Summary collapse

Methods inherited from Message

#and_metadata, build, #initialize, #payload_type, #with_metadata

Constructor Details

This class inherits a constructor from Synapse::Message

Class Method Details

.as_message(command) ⇒ CommandMessage

Creates a command message using the given command object

If the given object is an command message, it will be returned unchanged.

Parameters:

  • command (Object)

Returns:



16
17
18
19
20
21
22
23
24
# File 'lib/synapse/command/message.rb', line 16

def self.as_message(command)
  unless command.is_a? CommandMessage
    command = self.build do |builder|
      builder.payload = command
    end
  end

  command
end

.builderClass

Returns:

  • (Class)


6
7
8
# File 'lib/synapse/command/message.rb', line 6

def self.builder
  CommandMessageBuilder
end