lib/avromatic/model/raw_serialization.rb in avromatic-0.25.0 vs lib/avromatic/model/raw_serialization.rb in avromatic-0.26.0
- old
+ new
@@ -74,10 +74,14 @@
raise 'Model has no key schema' unless key_avro_schema
avro_raw_encode(key_attributes_for_avro, :key)
end
def value_attributes_for_avro
- avro_hash(value_avro_field_names)
+ if self.class.config.mutable
+ avro_hash(value_avro_field_names)
+ else
+ @value_attributes_for_avro ||= avro_hash(value_avro_field_names)
+ end
end
def key_attributes_for_avro
avro_hash(key_avro_field_names)
end