Module: Solace::Concerns::BinarySerializable
- Included in:
- AddressLookupTable, SerializableRecord
- Defined in:
- lib/solace/concerns/binary_serializable.rb
Instance Method Summary collapse
-
#to_binary ⇒ String
Returns the binary decoded from the serialized string.
-
#to_bytes ⇒ Array
Returns the bytes of the binary data as an array of integers.
-
#to_io ⇒ IO
Returns a StringIO stream of the binary data.
Instance Method Details
#to_binary ⇒ String
Returns the binary decoded from the serialized string
Expects the class to have a ‘serialize` method that returns a base64 string.
11 12 13 |
# File 'lib/solace/concerns/binary_serializable.rb', line 11 def to_binary Base64.decode64(serialize) end |
#to_bytes ⇒ Array
Returns 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_io ⇒ IO
Returns a 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 |