Class: RightSupport::Data::UnknownType
- Defined in:
- lib/right_support/data/unknown_type.rb
Overview
A type that can be instantiated by the DataSerializer (or anyone else) when an unknown Ruby type is encountered in serialized data. It functions like an OpenStruct, but it has a distinct type identity so the DataSerializer can work with it.
UnknownType remembers the original Ruby type name of the serialized object so it can be dumped back to a serialization stream without losing type identity or attribute information.
Instance Attribute Summary collapse
-
#__typename__ ⇒ Object
readonly
Returns the value of attribute __typename__.
Instance Method Summary collapse
-
#initialize(typename, attributes) ⇒ UnknownType
constructor
Construct a new object representing a serialized object of unknown type.
Constructor Details
#initialize(typename, attributes) ⇒ UnknownType
Construct a new object representing a serialized object of unknown type.
38 39 40 41 |
# File 'lib/right_support/data/unknown_type.rb', line 38 def initialize(typename, attributes) @__typename__ = typename super(attributes) end |
Instance Attribute Details
#__typename__ ⇒ Object (readonly)
Returns the value of attribute __typename__.
33 34 35 |
# File 'lib/right_support/data/unknown_type.rb', line 33 def __typename__ @__typename__ end |