Class: Temporalio::Converters::PayloadConverter::Encoding

Inherits:
Object
  • Object
show all
Defined in:
lib/temporalio/converters/payload_converter/encoding.rb

Overview

Base class for encoding converters that can be used for Composite converters. Each converter has an #encoding that should be set on the Payload metadata for values it can process. Implementers must implement #encoding

Instance Method Summary collapse

Instance Method Details

#encodingString

Returns Encoding that will be put on the payload metadata if this encoding converter can handle the value.

Returns:

  • (String)

    Encoding that will be put on the payload metadata if this encoding converter can handle the value.

Raises:

  • (NotImplementedError)


11
12
13
# File 'lib/temporalio/converters/payload_converter/encoding.rb', line 11

def encoding
  raise NotImplementedError
end

#from_payload(payload) ⇒ Object

Convert the payload to a Ruby value. The caller confirms the encoding metadata matches #encoding, so this will error if it cannot convert.

Parameters:

Returns:

  • (Object)

    Converted Ruby value.

Raises:

  • (NotImplementedError)


29
30
31
# File 'lib/temporalio/converters/payload_converter/encoding.rb', line 29

def from_payload(payload)
  raise NotImplementedError
end

#to_payload(value) ⇒ Api::Common::V1::Payload?

Convert value to payload if this encoding converter can handle it, or return nil. If the converter can handle it, the resulting payload must have encoding metadata on the payload set to the value of #encoding.

Parameters:

  • value (Object)

    Ruby value to possibly convert.

Returns:

Raises:

  • (NotImplementedError)


20
21
22
# File 'lib/temporalio/converters/payload_converter/encoding.rb', line 20

def to_payload(value)
  raise NotImplementedError
end