Module: Restate::BytesSerde

Defined in:
lib/restate/serde.rb

Overview

Pass-through bytes serializer/deserializer. Passes binary data through without transformation.

Class Method Summary collapse

Class Method Details

.deserialize(buf) ⇒ Object

Deserialize by returning the raw buffer unchanged.



51
52
53
# File 'lib/restate/serde.rb', line 51

def deserialize(buf)
  buf
end

.json_schemaObject

Return the JSON Schema for this serde, or nil if unspecified.



56
57
58
# File 'lib/restate/serde.rb', line 56

def json_schema
  nil
end

.serialize(obj) ⇒ Object

Serialize an object by returning its binary encoding. Returns empty bytes for nil.



44
45
46
47
48
# File 'lib/restate/serde.rb', line 44

def serialize(obj)
  return EMPTY_BYTES if obj.nil?

  obj.b
end