Module: Restate::BytesSerde

Defined in:
lib/restate/serde.rb,
sig/restate.rbs

Overview

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

Class Method Summary collapse

Class Method Details

.deserialize(buf) ⇒ String?

Deserialize by returning the raw buffer unchanged.

Parameters:

  • buf (String, nil)

Returns:

  • (String, nil)


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

def deserialize(buf)
  buf
end

.json_schemaHash[String, untyped]?

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

Returns:

  • (Hash[String, untyped], nil)


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

def json_schema
  nil
end

.serialize(obj) ⇒ String

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

Parameters:

  • obj (Object)

Returns:

  • (String)


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

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

  obj.b
end