Sha256: 415153d8caf58b6d346407fc702a1844a4249641efacd7af81fedcf3e726c83d

Contents?: true

Size: 706 Bytes

Versions: 1

Compression:

Stored size: 706 Bytes

Contents

require 'avro/builder/types/configurable_type'
require 'avro/builder/types/type_referencer'

module Avro
  module Builder
    module Types
      class MapType < Type
        include Avro::Builder::Types::SpecificType
        include Avro::Builder::Types::ConfigurableType
        include Avro::Builder::Types::TypeReferencer

        dsl_attribute :values do |value_type = nil|
          if value_type
            @values = find_or_create_type(value_type)
          else
            @values
          end
        end

        def serialize(referenced_state)
          {
            type: type_name,
            values: values.serialize(referenced_state)
          }
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
avro-builder-0.1.0 lib/avro/builder/types/map_type.rb