module Avro::Builder::Types::ComplexType
This module provides common functionality for non-primitive types that do not require a name to be created.
Public Class Methods
included(base)
click to toggle source
# File lib/avro/builder/types/complex_type.rb, line 11 def self.included(base) base.extend ClassMethods end
new(cache:, field: nil)
click to toggle source
Override initialize so that type name is not required
Calls superclass method
# File lib/avro/builder/types/complex_type.rb, line 16 def initialize(cache:, field: nil) super(self.class.avro_type_name, cache: cache, field: field) end
Public Instance Methods
namespace()
click to toggle source
# File lib/avro/builder/types/complex_type.rb, line 20 def namespace field.namespace end
serialize(_reference_state, overrides: {})
click to toggle source
# File lib/avro/builder/types/complex_type.rb, line 24 def serialize(_reference_state, overrides: {}) { type: avro_type_name, logicalType: logical_type }.merge(overrides).reject { |_, v| v.nil? } end
to_h(reference_state)
click to toggle source
# File lib/avro/builder/types/complex_type.rb, line 31 def to_h(reference_state) serialize(reference_state) end