Class: Avromatic::Model::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/avromatic/model/configuration.rb

Overview

This class holds configuration for a model built from Avro schema(s).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**options) ⇒ Configuration

Either schema(_name) or value_schema(_name), but not both, must be specified.

Parameters:

  • options (Hash)

Options Hash (**options):

  • :schema (Avro::Schema)
  • :schema_name (String, Symbol)
  • :value_schema (Avro::Schema)
  • :value_schema_name (String, Symbol)
  • :key_schema (Avro::Schema)
  • :key_schema_name (String, Symbol)

Raises:

  • (ArgumentError)


20
21
22
23
24
# File 'lib/avromatic/model/configuration.rb', line 20

def initialize(**options)
  @avro_schema = find_avro_schema(**options)
  raise ArgumentError.new('value_schema(_name) or schema(_name) must be specified') unless avro_schema
  @key_avro_schema = find_schema_by_option(:key_schema, **options)
end

Instance Attribute Details

#avro_schemaObject (readonly) Also known as: value_avro_schema

Returns the value of attribute avro_schema.



7
8
9
# File 'lib/avromatic/model/configuration.rb', line 7

def avro_schema
  @avro_schema
end

#key_avro_schemaObject (readonly)

Returns the value of attribute key_avro_schema.



7
8
9
# File 'lib/avromatic/model/configuration.rb', line 7

def key_avro_schema
  @key_avro_schema
end