Class: Avromatic::Model::Types::AbstractType
- Inherits:
-
Object
- Object
- Avromatic::Model::Types::AbstractType
show all
- Defined in:
- lib/avromatic/model/types/abstract_type.rb
Direct Known Subclasses
AbstractTimestampType, ArrayType, BigIntType, BooleanType, CustomType, DateType, DecimalType, EnumType, FixedType, FloatType, IntegerType, MapType, NullType, RecordType, StringType, UnionType
Instance Method Summary
collapse
Instance Method Details
#coerce(_input) ⇒ Object
23
24
25
|
# File 'lib/avromatic/model/types/abstract_type.rb', line 23
def coerce(_input)
raise "#{__method__} must be overridden by #{self.class.name}"
end
|
#coerced?(value) ⇒ Boolean
31
32
33
|
# File 'lib/avromatic/model/types/abstract_type.rb', line 31
def coerced?(value)
value.nil? || value_classes.any? { |value_class| value.is_a?(value_class) }
end
|
#coercible?(input) ⇒ Boolean
27
28
29
|
# File 'lib/avromatic/model/types/abstract_type.rb', line 27
def coercible?(input)
input.nil? || input_classes.any? { |input_class| input.is_a?(input_class) }
end
|
15
16
17
|
# File 'lib/avromatic/model/types/abstract_type.rb', line 15
def input_classes
value_classes
end
|
#name ⇒ Object
19
20
21
|
# File 'lib/avromatic/model/types/abstract_type.rb', line 19
def name
raise "#{__method__} must be overridden by #{self.class.name}"
end
|
#referenced_model_classes ⇒ Object
41
42
43
|
# File 'lib/avromatic/model/types/abstract_type.rb', line 41
def referenced_model_classes
raise "#{__method__} must be overridden by #{self.class.name}"
end
|
#serialize(_value, _strict) ⇒ Object
Note we use positional args rather than keyword args to reduce memory allocations
37
38
39
|
# File 'lib/avromatic/model/types/abstract_type.rb', line 37
def serialize(_value, _strict)
raise "#{__method__} must be overridden by #{self.class.name}"
end
|
#value_classes ⇒ Object
11
12
13
|
# File 'lib/avromatic/model/types/abstract_type.rb', line 11
def value_classes
raise "#{__method__} must be overridden by #{self.class.name}"
end
|