Module: Solace::Concerns::BinarySerializable

Included in:
AddressLookupTable, SerializableRecord
Defined in:
lib/solace/concerns/binary_serializable.rb

Instance Method Summary collapse

Instance Method Details

#to_binaryString

Returns the binary decoded from the serialized string

Expects the class to have a ‘serialize` method that returns a base64 string.

Returns:

  • (String)

    The binary decoded from the serialized string



11
12
13
# File 'lib/solace/concerns/binary_serializable.rb', line 11

def to_binary
  Base64.decode64(serialize)
end

#to_bytesArray

Returns the bytes of the binary data as an array of integers

Returns:

  • (Array)

    The bytes of the binary data as an array of integers



25
26
27
# File 'lib/solace/concerns/binary_serializable.rb', line 25

def to_bytes
  to_binary.bytes
end

#to_ioIO

Returns a StringIO stream of the binary data

Returns:

  • (IO)

    The StringIO stream of the binary data



18
19
20
# File 'lib/solace/concerns/binary_serializable.rb', line 18

def to_io
  StringIO.new(to_binary)
end