Sha256: 0e7c55bc6ba0fc075020d4db717caac51b7c05ade1d7e0767894311634f10697

Contents?: true

Size: 556 Bytes

Versions: 5

Compression:

Stored size: 556 Bytes

Contents

# frozen_string_literal: true

require 'active_support/inflector/methods'

module Avromatic
  module Model
    # This module handles integration with the ModelRegistry and support
    # for nested model reuse.
    module NestedModels
      extend ActiveSupport::Concern

      module ClassMethods
        # Register this model if it can be used as a nested model.
        def register!
          if key_avro_schema.nil? && value_avro_schema.type_sym == :record
            nested_models.register(self)
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
avromatic-2.2.1 lib/avromatic/model/nested_models.rb
avromatic-2.2.0 lib/avromatic/model/nested_models.rb
avromatic-2.1.0 lib/avromatic/model/nested_models.rb
avromatic-2.0.1 lib/avromatic/model/nested_models.rb
avromatic-2.0.0 lib/avromatic/model/nested_models.rb