Module: Avromatic::Model::RawSerialization::ClassMethods

Includes:
Decode
Defined in:
lib/avromatic/model/raw_serialization.rb

Instance Method Summary collapse

Methods included from Decode

#avro_raw_decode

Instance Method Details

#avro_serializerObject

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.



102
103
104
# File 'lib/avromatic/model/raw_serialization.rb', line 102

def avro_serializer
  @avro_serializer ||= Hash.new(PassthroughSerializer)
end

#datum_readerObject



114
115
116
117
118
119
120
# File 'lib/avromatic/model/raw_serialization.rb', line 114

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_writerObject



106
107
108
109
110
111
112
# File 'lib/avromatic/model/raw_serialization.rb', line 106

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