Module: Avro::Builder::AnonymousTypes

Includes:
TypeFactory
Included in:
DSL, Field, Types::RecordType
Defined in:
lib/avro/builder/anonymous_types.rb

Overview

This concern is included by contexts where anonymous types can be defined.

Constant Summary

Constants included from TypeFactory

TypeFactory::BUILTIN_TYPES, TypeFactory::COMPLEX_TYPES, TypeFactory::NAMED_TYPES

Instance Method Summary collapse

Instance Method Details

#array(items, options = {}, &block) ⇒ Object



20
21
22
# File 'lib/avro/builder/anonymous_types.rb', line 20

def array(items, options = {}, &block)
  type(__method__, { items: items }.merge(options), &block)
end

#map(values, options = {}, &block) ⇒ Object



24
25
26
# File 'lib/avro/builder/anonymous_types.rb', line 24

def map(values, options = {}, &block)
  type(__method__, { values: values }.merge(options), &block)
end

#type(type_name, options = {}, &block) ⇒ Object



28
29
30
31
32
33
# File 'lib/avro/builder/anonymous_types.rb', line 28

def type(type_name, options = {}, &block)
  create_and_configure_builtin_type(type_name,
                                    cache: cache,
                                    internal: options,
                                    &block)
end

#union(*types, &block) ⇒ Object



16
17
18
# File 'lib/avro/builder/anonymous_types.rb', line 16

def union(*types, &block)
  type(__method__, { types: types }, &block)
end