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

#datum_readerObject



162
163
164
165
166
167
168
# File 'lib/avromatic/model/raw_serialization.rb', line 162

def datum_reader
  @datum_reader ||= begin
    hash = { value: datum_reader_class.new(value_avro_schema) }
    hash[:key] = datum_reader_class.new(key_avro_schema) if key_avro_schema
    hash
  end
end

#datum_reader_classObject



146
147
148
# File 'lib/avromatic/model/raw_serialization.rb', line 146

def datum_reader_class
  Avromatic.use_custom_datum_reader ? Avromatic::IO::DatumReader : Avro::IO::DatumReader
end

#datum_writerObject



154
155
156
157
158
159
160
# File 'lib/avromatic/model/raw_serialization.rb', line 154

def datum_writer
  @datum_writer ||= begin
    hash = { value: datum_writer_class.new(value_avro_schema) }
    hash[:key] = datum_writer_class.new(key_avro_schema) if key_avro_schema
    hash
  end
end

#datum_writer_classObject



150
151
152
# File 'lib/avromatic/model/raw_serialization.rb', line 150

def datum_writer_class
  Avromatic.use_custom_datum_writer ? Avromatic::IO::DatumWriter : Avro::IO::DatumWriter
end