Class: Synapse::Serialization::SerializedMessageBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/synapse/serialization/message/serialized_message_builder.rb

Overview

Message builder capable of producing SerializedMessage instances

Direct Known Subclasses

SerializedEventMessageBuilder

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#idString

Returns:

  • (String)


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

def id
  @id
end

#metadataLazyObject

Returns:



9
10
11
# File 'lib/synapse/serialization/message/serialized_message_builder.rb', line 9

def 
  @metadata
end

#payloadLazyObject

Returns:



12
13
14
# File 'lib/synapse/serialization/message/serialized_message_builder.rb', line 12

def payload
  @payload
end

#timestampTime

Returns:

  • (Time)


15
16
17
# File 'lib/synapse/serialization/message/serialized_message_builder.rb', line 15

def timestamp
  @timestamp
end

Class Method Details

.build {|builder| ... } ⇒ Object

Yields:

  • (builder)


17
18
19
20
21
22
23
# File 'lib/synapse/serialization/message/serialized_message_builder.rb', line 17

def self.build
  builder = self.new

  yield builder if block_given?

  builder.build
end

Instance Method Details

#buildObject



25
26
27
# File 'lib/synapse/serialization/message/serialized_message_builder.rb', line 25

def build
  SerializedMessage.new @id, @metadata, @payload, @timestamp
end