Module: Avromatic::Model::RawSerialization::Encode
- Extended by:
- ActiveSupport::Concern
- Included in:
- Avromatic::Model::RawSerialization
- Defined in:
- lib/avromatic/model/raw_serialization.rb
Instance Method Summary collapse
- #avro_key_datum(validate: true) ⇒ Object
- #avro_raw_key(validate: true) ⇒ Object
- #avro_raw_value(validate: true) ⇒ Object
- #avro_value_datum(validate: true) ⇒ Object
- #key_attributes_for_avro(validate: true) ⇒ Object
- #value_attributes_for_avro(validate: true) ⇒ Object
Instance Method Details
#avro_key_datum(validate: true) ⇒ Object
50 51 52 |
# File 'lib/avromatic/model/raw_serialization.rb', line 50 def avro_key_datum(validate: true) avro_hash(key_avro_field_names, strict: true, validate: validate) end |
#avro_raw_key(validate: true) ⇒ Object
25 26 27 28 |
# File 'lib/avromatic/model/raw_serialization.rb', line 25 def avro_raw_key(validate: true) raise 'Model has no key schema' unless key_avro_schema avro_raw_encode(key_attributes_for_avro(validate: validate), :key) end |
#avro_raw_value(validate: true) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/avromatic/model/raw_serialization.rb', line 17 def avro_raw_value(validate: true) if self.class.config.mutable avro_raw_encode(value_attributes_for_avro(validate: validate), :value) else @avro_raw_value ||= avro_raw_encode(value_attributes_for_avro(validate: validate), :value) end end |
#avro_value_datum(validate: true) ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/avromatic/model/raw_serialization.rb', line 42 def avro_value_datum(validate: true) if self.class.config.mutable avro_hash(value_avro_field_names, strict: true, validate: validate) else @avro_datum ||= avro_hash(value_avro_field_names, strict: true, validate: validate) end end |
#key_attributes_for_avro(validate: true) ⇒ Object
38 39 40 |
# File 'lib/avromatic/model/raw_serialization.rb', line 38 def key_attributes_for_avro(validate: true) avro_hash(key_avro_field_names, validate: validate) end |
#value_attributes_for_avro(validate: true) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/avromatic/model/raw_serialization.rb', line 30 def value_attributes_for_avro(validate: true) if self.class.config.mutable avro_hash(value_avro_field_names, validate: validate) else @value_attributes_for_avro ||= avro_hash(value_avro_field_names, validate: validate) end end |