Module: Synapse::Serialization::Converter

Extended by:
ActiveSupport::Concern
Included in:
ConverterChain, IdentityConverter, JsonToObjectConverter, ObjectToJsonConverter, OxDocumentToXmlConverter, XmlToOxDocumentConverter
Defined in:
lib/synapse/serialization/converter.rb

Overview

Represents a mechanism for converting content of one type to another type for the purposes of serialization, deserialization and upcasting.

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#convert(original) ⇒ SerializedObject

Parameters:

Returns:



29
30
31
# File 'lib/synapse/serialization/converter.rb', line 29

def convert(original)
  SerializedObject.new(convert_content(original.content), target_type, original.type)
end

#convert_content(original) ⇒ Object

This method is abstract.

Parameters:

  • original (Object)

Returns:

  • (Object)

Raises:

  • (NotImplementedError)


36
37
38
# File 'lib/synapse/serialization/converter.rb', line 36

def convert_content(original)
  raise NotImplementedError
end

#initialize(options = {}) ⇒ Object



23
24
25
# File 'lib/synapse/serialization/converter.rb', line 23

def initialize(options = {})
  @options = options
end