Class: Avro::Builder::Types::ComplexType
- Defined in:
- lib/avro/builder/types/complex_type.rb
Overview
This is an abstract class that provides common functionality for non-primitive types that do not require a name to be created.
Constant Summary
Constants included from DslAttributes
DslAttributes::ATTRIBUTE_NAMES
Instance Attribute Summary
Attributes inherited from Type
Class Method Summary collapse
-
.avro_type_name ⇒ Object
Infer avro_type_name based on class.
Instance Method Summary collapse
-
#initialize(cache:, field: nil) ⇒ ComplexType
constructor
Override initialize so that type name is not required.
- #namespace ⇒ Object
Methods inherited from Type
#abstract?, #cache!, #configure_options, #dsl_method?, #dsl_respond_to?, #serialize, #to_h, union_with_null, #validate!
Methods included from Metadata
attribute?, #method_missing, register, reset!, #respond_to_missing?
Methods included from DslAttributes
Methods included from DslOptions
Constructor Details
#initialize(cache:, field: nil) ⇒ ComplexType
Override initialize so that type name is not required
17 18 19 |
# File 'lib/avro/builder/types/complex_type.rb', line 17 def initialize(cache:, field: nil) super(self.class.avro_type_name, cache: cache, field: field) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Avro::Builder::Metadata
Class Method Details
.avro_type_name ⇒ Object
Infer avro_type_name based on class
12 13 14 |
# File 'lib/avro/builder/types/complex_type.rb', line 12 def self.avro_type_name @avro_type_name ||= name.split('::').last.sub('Type', '').downcase.to_sym end |
Instance Method Details
#namespace ⇒ Object
21 22 23 |
# File 'lib/avro/builder/types/complex_type.rb', line 21 def namespace field.namespace end |