class Avro::LogicalTypes::LogicalTypeWithSchema
Base class for logical types requiring a schema to be present
Attributes
schema[R]
@return [Avro::Schema] The schema this logical type is dealing with
Public Class Methods
new(schema)
click to toggle source
Build a new instance of a logical type using the provided schema
@param schema [Avro::Schema]
The schema to use with this instance
@raise [ArgumentError]
If the provided schema is nil
# File lib/avro/logical_types.rb 39 def initialize(schema) 40 raise ArgumentError, 'schema is required' if schema.nil? 41 42 @schema = schema 43 end
Public Instance Methods
decode(datum)
click to toggle source
Decode the provided datum
@param datum [Object] The datum to decode
@raise [NotImplementedError]
Subclass will need to override this method
# File lib/avro/logical_types.rb 63 def decode(datum) 64 raise NotImplementedError 65 end
encode(datum)
click to toggle source
Encode the provided datum
@param datum [Object] The datum to encode
@raise [NotImplementedError]
Subclass will need to override this method
# File lib/avro/logical_types.rb 52 def encode(datum) 53 raise NotImplementedError 54 end