Sha256: 7a8af3238c664bcbb6de4a74bafbac4aafceeca513d111039a65d1a1978208da
Contents?: true
Size: 1.04 KB
Versions: 8
Compression:
Stored size: 1.04 KB
Contents
module Avro module Builder module Types # This module provides common functionality for non-primitive types # that do not require a name to be created. module ComplexType def self.included(base) base.extend ClassMethods end # Override initialize so that type name is not required def initialize(cache:, field: nil) super(self.class.avro_type_name, cache: cache, field: field) end def namespace field.namespace end def serialize(_reference_state, overrides: {}) { type: avro_type_name, logicalType: logical_type }.merge(overrides).reject { |_, v| v.nil? } end def to_h(reference_state) serialize(reference_state) end module ClassMethods # Infer avro_type_name based on class def avro_type_name @avro_type_name ||= name.split('::').last.sub('Type', '').downcase.to_sym end end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems