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



18
19
20
# File 'lib/avro/builder/anonymous_types.rb', line 18

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

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



22
23
24
# File 'lib/avro/builder/anonymous_types.rb', line 22

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

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



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

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

#union(*types, &block) ⇒ Object



14
15
16
# File 'lib/avro/builder/anonymous_types.rb', line 14

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