Class: Solace::SerializableRecord

Inherits:
Object
  • Object
show all
Includes:
Concerns::BinarySerializable
Defined in:
lib/solace/serializable_record.rb

Direct Known Subclasses

Instruction, Message, Transaction

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Concerns::BinarySerializable

#to_binary, #to_bytes, #to_io

Class Method Details

.deserialize(io) ⇒ Solace::Instruction

Parse instruction from io stream

Parameters:

  • io (IO or StringIO)

    The input to read bytes from.

Returns:



11
12
13
14
15
# File 'lib/solace/serializable_record.rb', line 11

def self.deserialize(io)
  self::DESERIALIZER.call(io)
rescue NameError => e
  raise "DESERIALIZER must be defined: #{e.message}"
end

Instance Method Details

#serializeString

Serializes the transaction to a binary format

Returns:

  • (String)

    The serialized transaction (binary)



20
21
22
23
24
# File 'lib/solace/serializable_record.rb', line 20

def serialize
  self.class::SERIALIZER.call(self)
rescue NameError => e
  raise "SERIALIZER must be defined: #{e.message}"
end