Class: Deimos::AvroDataCoder
- Inherits:
-
Object
- Object
- Deimos::AvroDataCoder
- Defined in:
- lib/deimos/avro_data_coder.rb
Overview
Base class for the encoder / decoder classes.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#namespace ⇒ Object
Returns the value of attribute namespace.
-
#schema ⇒ Object
Returns the value of attribute schema.
-
#schema_store ⇒ Object
Returns the value of attribute schema_store.
Instance Method Summary collapse
- #avro_schema(schema = nil) ⇒ Avro::Schema
-
#initialize(schema:, namespace:, schema_store: nil) ⇒ AvroDataCoder
constructor
A new instance of AvroDataCoder.
Constructor Details
#initialize(schema:, namespace:, schema_store: nil) ⇒ AvroDataCoder
Returns a new instance of AvroDataCoder.
11 12 13 14 15 16 |
# File 'lib/deimos/avro_data_coder.rb', line 11 def initialize(schema:, namespace:, schema_store: nil) @schema = schema @namespace = namespace @schema_store = schema_store || AvroTurf::SchemaStore.new(path: Deimos.config.schema_path) end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
6 7 8 |
# File 'lib/deimos/avro_data_coder.rb', line 6 def config @config end |
#namespace ⇒ Object
Returns the value of attribute namespace.
6 7 8 |
# File 'lib/deimos/avro_data_coder.rb', line 6 def namespace @namespace end |
#schema ⇒ Object
Returns the value of attribute schema.
6 7 8 |
# File 'lib/deimos/avro_data_coder.rb', line 6 def schema @schema end |
#schema_store ⇒ Object
Returns the value of attribute schema_store.
6 7 8 |
# File 'lib/deimos/avro_data_coder.rb', line 6 def schema_store @schema_store end |
Instance Method Details
#avro_schema(schema = nil) ⇒ Avro::Schema
20 21 22 23 |
# File 'lib/deimos/avro_data_coder.rb', line 20 def avro_schema(schema=nil) schema ||= @schema @schema_store.find(schema, @namespace) end |