Class: Avro::LogicalTypes::LogicalTypeWithSchema
- Inherits:
-
Object
- Object
- Avro::LogicalTypes::LogicalTypeWithSchema
- Defined in:
- lib/avro/logical_types.rb
Overview
Base class for logical types requiring a schema to be present
Direct Known Subclasses
Instance Attribute Summary collapse
-
#schema ⇒ Avro::Schema
readonly
The schema this logical type is dealing with.
Instance Method Summary collapse
-
#decode(datum) ⇒ Object
Decode the provided datum.
-
#encode(datum) ⇒ Object
Encode the provided datum.
-
#initialize(schema) ⇒ LogicalTypeWithSchema
constructor
Build a new instance of a logical type using the provided schema.
Constructor Details
#initialize(schema) ⇒ LogicalTypeWithSchema
Build a new instance of a logical type using the provided schema
40 41 42 43 44 |
# File 'lib/avro/logical_types.rb', line 40 def initialize(schema) raise ArgumentError, 'schema is required' if schema.nil? @schema = schema end |
Instance Attribute Details
#schema ⇒ Avro::Schema (readonly)
Returns The schema this logical type is dealing with.
30 31 32 |
# File 'lib/avro/logical_types.rb', line 30 def schema @schema end |
Instance Method Details
#decode(datum) ⇒ Object
Decode the provided datum
64 65 66 |
# File 'lib/avro/logical_types.rb', line 64 def decode(datum) raise NotImplementedError end |
#encode(datum) ⇒ Object
Encode the provided datum
53 54 55 |
# File 'lib/avro/logical_types.rb', line 53 def encode(datum) raise NotImplementedError end |