Module: Avromatic::Model::RawSerialization::ClassMethods
- Includes:
- Decode
- Defined in:
- lib/avromatic/model/raw_serialization.rb
Instance Method Summary collapse
-
#avro_serializer ⇒ Object
Store a hash of Procs by field name (as a symbol) to convert the value before Avro serialization.
- #datum_reader ⇒ Object
- #datum_writer ⇒ Object
Methods included from Decode
Instance Method Details
#avro_serializer ⇒ Object
Store a hash of Procs by field name (as a symbol) to convert the value before Avro serialization. Returns the default PassthroughSerializer if a key is not present.
87 88 89 |
# File 'lib/avromatic/model/raw_serialization.rb', line 87 def avro_serializer @avro_serializer ||= Hash.new(PassthroughSerializer) end |
#datum_reader ⇒ Object
99 100 101 102 103 104 105 |
# File 'lib/avromatic/model/raw_serialization.rb', line 99 def datum_reader @datum_reader ||= begin hash = { value: Avro::IO::DatumReader.new(value_avro_schema) } hash[:key] = Avro::IO::DatumReader.new(key_avro_schema) if key_avro_schema hash end end |
#datum_writer ⇒ Object
91 92 93 94 95 96 97 |
# File 'lib/avromatic/model/raw_serialization.rb', line 91 def datum_writer @datum_writer ||= begin hash = { value: Avro::IO::DatumWriter.new(value_avro_schema) } hash[:key] = Avro::IO::DatumWriter.new(key_avro_schema) if key_avro_schema hash end end |