Class: Avromatic::Model::Configuration
- Inherits:
-
Object
- Object
- Avromatic::Model::Configuration
- Defined in:
- lib/avromatic/model/configuration.rb
Overview
This class holds configuration for a model built from Avro schema(s).
Instance Attribute Summary collapse
-
#allow_optional_key_fields ⇒ Object
readonly
Returns the value of attribute allow_optional_key_fields.
-
#avro_schema ⇒ Object
(also: #value_avro_schema)
readonly
Returns the value of attribute avro_schema.
-
#avro_schema_subject ⇒ Object
(also: #value_avro_schema_subject)
readonly
Returns the value of attribute avro_schema_subject.
-
#key_avro_schema ⇒ Object
readonly
Returns the value of attribute key_avro_schema.
-
#key_avro_schema_subject ⇒ Object
readonly
Returns the value of attribute key_avro_schema_subject.
-
#mutable ⇒ Object
(also: #mutable?)
readonly
Returns the value of attribute mutable.
-
#nested_models ⇒ Object
readonly
Returns the value of attribute nested_models.
Instance Method Summary collapse
- #immutable? ⇒ Boolean
-
#initialize(**options) ⇒ Configuration
constructor
Either schema(_name) or value_schema(_name), but not both, must be specified.
Constructor Details
#initialize(**options) ⇒ Configuration
Either schema(_name) or value_schema(_name), but not both, must be specified.
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/avromatic/model/configuration.rb', line 30 def initialize(**) @avro_schema = find_avro_schema(**) @avro_schema_subject = [:schema_subject] || [:value_schema_subject] raise ArgumentError.new('value_schema(_name) or schema(_name) must be specified') unless avro_schema @key_avro_schema = find_schema_by_option(:key_schema, **) @key_avro_schema_subject = [:key_schema_subject] @nested_models = [:nested_models] @mutable = .fetch(:mutable, false) @allow_optional_key_fields = .fetch(:allow_optional_key_fields, false) end |
Instance Attribute Details
#allow_optional_key_fields ⇒ Object (readonly)
Returns the value of attribute allow_optional_key_fields.
9 10 11 |
# File 'lib/avromatic/model/configuration.rb', line 9 def allow_optional_key_fields @allow_optional_key_fields end |
#avro_schema ⇒ Object (readonly) Also known as: value_avro_schema
Returns the value of attribute avro_schema.
9 10 11 |
# File 'lib/avromatic/model/configuration.rb', line 9 def avro_schema @avro_schema end |
#avro_schema_subject ⇒ Object (readonly) Also known as: value_avro_schema_subject
Returns the value of attribute avro_schema_subject.
9 10 11 |
# File 'lib/avromatic/model/configuration.rb', line 9 def avro_schema_subject @avro_schema_subject end |
#key_avro_schema ⇒ Object (readonly)
Returns the value of attribute key_avro_schema.
9 10 11 |
# File 'lib/avromatic/model/configuration.rb', line 9 def key_avro_schema @key_avro_schema end |
#key_avro_schema_subject ⇒ Object (readonly)
Returns the value of attribute key_avro_schema_subject.
9 10 11 |
# File 'lib/avromatic/model/configuration.rb', line 9 def key_avro_schema_subject @key_avro_schema_subject end |
#mutable ⇒ Object (readonly) Also known as: mutable?
Returns the value of attribute mutable.
9 10 11 |
# File 'lib/avromatic/model/configuration.rb', line 9 def mutable @mutable end |
#nested_models ⇒ Object (readonly)
Returns the value of attribute nested_models.
9 10 11 |
# File 'lib/avromatic/model/configuration.rb', line 9 def nested_models @nested_models end |
Instance Method Details
#immutable? ⇒ Boolean
45 46 47 |
# File 'lib/avromatic/model/configuration.rb', line 45 def immutable? !mutable? end |