Class: SoberSwag::Serializer::Primitive
- Defined in:
- lib/sober_swag/serializer/primitive.rb
Overview
A class that does no serialization: you give it a type, and it will pass any serialized input on verbatim.
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type) ⇒ Primitive
constructor
Construct a primitive serializer with a description of the type it serializes to.
- #serialize(object, _options = {}) ⇒ Object
Methods inherited from Base
#array, #finalize_lazy_type!, #identifier, #lazy_type, #lazy_type?, #meta, #optional, #serializer, #via_map
Constructor Details
#initialize(type) ⇒ Primitive
Construct a primitive serializer with a description of the type it serializes to.
10 11 12 |
# File 'lib/sober_swag/serializer/primitive.rb', line 10 def initialize(type) @type = type end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
14 15 16 |
# File 'lib/sober_swag/serializer/primitive.rb', line 14 def type @type end |
Instance Method Details
#serialize(object, _options = {}) ⇒ Object
16 17 18 |
# File 'lib/sober_swag/serializer/primitive.rb', line 16 def serialize(object, = {}) object end |