Module: Synapse::Upcasting::Upcaster
- Extended by:
- ActiveSupport::Concern
- Included in:
- SingleUpcaster
- Defined in:
- lib/synapse/upcasting/upcaster.rb
Overview
Represents a mechanism for converting deprecated serialized objects into the current format used by the application. If the serializer itself is not able to cope with the changed formats, an upcaster provides flexibility for more complex structural transformations.
Upcasters work on intermediate representations of the object to upcast. In most cases, this representation is an object structure of some kind. The serializer is responsible for converting the intermediate representation form to one that is compatible with the upcaster.
For performance reasons, it is advisable to ensure that all upcasters in the same chain use the same intermediate representation type.
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#can_upcast?(serialized_type) ⇒ Boolean
abstract
Returns true if this upcaster is capable of upcasting the given type.
-
#upcast(intermediate, expected_types, upcast_context) ⇒ Array<SerializedObject>
abstract
Upcasts a given serialized object to zero or more upcast objects.
-
#upcast_type(serialized_type) ⇒ Array<SerializedType>
abstract
Upcasts a given serialized type to zero or more upcast types.
Instance Method Details
#can_upcast?(serialized_type) ⇒ Boolean
Returns true if this upcaster is capable of upcasting the given type
33 |
# File 'lib/synapse/upcasting/upcaster.rb', line 33 def can_upcast?(serialized_type); end |
#upcast(intermediate, expected_types, upcast_context) ⇒ Array<SerializedObject>
Upcasts a given serialized object to zero or more upcast objects
The types of the upcast objects should match the same length and order of the given array of upcast types.
45 |
# File 'lib/synapse/upcasting/upcaster.rb', line 45 def upcast(intermediate, expected_types, upcast_context); end |
#upcast_type(serialized_type) ⇒ Array<SerializedType>
Upcasts a given serialized type to zero or more upcast types
52 |
# File 'lib/synapse/upcasting/upcaster.rb', line 52 def upcast_type(serialized_type); end |