Class: Euston::EventStore::CommandMessage
- Inherits:
-
Object
- Object
- Euston::EventStore::CommandMessage
- Defined in:
- lib/euston-eventstore/command_message.rb,
lib/euston-eventstore/persistence/mongodb/mongo_command_message.rb
Overview
Represents a single element in a stream of commands.
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Gets or sets the actual comman body.
-
#headers ⇒ Object
readonly
Gets the metadata which provides additional, unstructured information about this command.
Instance Method Summary collapse
-
#initialize(arg = nil) ⇒ CommandMessage
constructor
A new instance of CommandMessage.
- #to_hash ⇒ Object
Methods included from Persistence::Mongodb::MongoCommandMessage
Constructor Details
#initialize(arg = nil) ⇒ CommandMessage
Returns a new instance of CommandMessage.
6 7 8 9 10 11 12 13 |
# File 'lib/euston-eventstore/command_message.rb', line 6 def initialize arg = nil if arg.is_a?(Hash) && (arg.keys & ['body','headers']).size == 2 @body, @headers = arg.values_at('body','headers') else @headers = {} @body = arg end end |
Instance Attribute Details
#body ⇒ Object (readonly)
Gets or sets the actual comman body.
23 24 25 |
# File 'lib/euston-eventstore/command_message.rb', line 23 def body @body end |
#headers ⇒ Object (readonly)
Gets the metadata which provides additional, unstructured information about this command.
20 21 22 |
# File 'lib/euston-eventstore/command_message.rb', line 20 def headers @headers end |
Instance Method Details
#to_hash ⇒ Object
15 16 17 |
# File 'lib/euston-eventstore/command_message.rb', line 15 def to_hash { :headers => @headers, :body => @body } end |