class Avromatic::Model::Types::FixedType
Constants
- VALUE_CLASSES
Attributes
Public Class Methods
Source
# File lib/avromatic/model/types/fixed_type.rb, line 13 def initialize(size) super() @size = size end
Calls superclass method
Public Instance Methods
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
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?
Source
# File lib/avromatic/model/types/fixed_type.rb, line 18 def name "fixed(#{size})" end
Source
# File lib/avromatic/model/types/fixed_type.rb, line 44 def referenced_model_classes EMPTY_ARRAY end
Source
# File lib/avromatic/model/types/fixed_type.rb, line 40 def serialize(value, _strict) value end
Source
# File lib/avromatic/model/types/fixed_type.rb, line 22 def value_classes VALUE_CLASSES end