class Avromatic::Model::Types::IntegerType
Constants
- MAX_RANGE
- VALUE_CLASSES
Public Class Methods
Source
# File lib/avromatic/model/types/integer_type.rb, line 13 def self.in_range?(value) value.is_a?(::Integer) && value.between?(-MAX_RANGE, MAX_RANGE - 1) end
Public Instance Methods
Source
# File lib/avromatic/model/types/integer_type.rb, line 25 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/integer_type.rb, line 33 def coercible?(input) input.nil? || self.class.in_range?(input) end
Also aliased as: coerced?
Source
# File lib/avromatic/model/types/integer_type.rb, line 43 def referenced_model_classes EMPTY_ARRAY end
Source
# File lib/avromatic/model/types/integer_type.rb, line 39 def serialize(value, _strict) value end
Source
# File lib/avromatic/model/types/integer_type.rb, line 17 def value_classes VALUE_CLASSES end