class Avromatic::Model::Types::FixedType
Constants
- VALUE_CLASSES
Attributes
size[R]
Public Class Methods
new(size)
click to toggle source
Calls superclass method
# File lib/avromatic/model/types/fixed_type.rb, line 13 def initialize(size) super() @size = size end
Public Instance Methods
coerce(input)
click to toggle source
# File lib/avromatic/model/types/fixed_type.rb, line 26 def coerce(input) if coercible?(input) input else raise ArgumentError.new("Could not coerce '#{input.inspect}' to #{name}") end end
coercible?(input)
click to toggle source
# File lib/avromatic/model/types/fixed_type.rb, line 34 def coercible?(input) input.nil? || (input.is_a?(::String) && input.length == size) end
Also aliased as: coerced?
name()
click to toggle source
# File lib/avromatic/model/types/fixed_type.rb, line 18 def name "fixed(#{size})" end
referenced_model_classes()
click to toggle source
# File lib/avromatic/model/types/fixed_type.rb, line 44 def referenced_model_classes EMPTY_ARRAY end
serialize(value, _strict)
click to toggle source
# File lib/avromatic/model/types/fixed_type.rb, line 40 def serialize(value, _strict) value end
value_classes()
click to toggle source
# File lib/avromatic/model/types/fixed_type.rb, line 22 def value_classes VALUE_CLASSES end