Class: Typed::Serializer

Inherits:
Object
  • Object
show all
Extended by:
T::Generic, T::Helpers, T::Sig
Defined in:
lib/typed/serializer.rb

Constant Summary collapse

Input =
type_member
Output =
type_member
Params =
T.type_alias { T::Hash[Symbol, T.untyped] }
DeserializeResult =
T.type_alias { Result[T::Struct, DeserializeError] }

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(schema:) ⇒ Serializer

Returns a new instance of Serializer.



22
23
24
25
# File 'lib/typed/serializer.rb', line 22

def initialize(schema:)
  @schema = schema
  @coercer_cache = T.let({}, T::Hash[T::Types::Base, T.untyped])
end

Instance Attribute Details

#coercer_cacheObject (readonly)

Returns the value of attribute coercer_cache.



19
20
21
# File 'lib/typed/serializer.rb', line 19

def coercer_cache
  @coercer_cache
end

#schemaObject (readonly)

Returns the value of attribute schema.



16
17
18
# File 'lib/typed/serializer.rb', line 16

def schema
  @schema
end

Instance Method Details

#deserialize(source) ⇒ Object



28
29
# File 'lib/typed/serializer.rb', line 28

def deserialize(source)
end

#serialize(struct) ⇒ Object



32
33
# File 'lib/typed/serializer.rb', line 32

def serialize(struct)
end