class Avromatic::Model::Types::FloatType

Constants

INPUT_CLASSES
VALUE_CLASSES

Public Instance Methods

coerce(input) click to toggle source
# File lib/avromatic/model/types/float_type.rb, line 24
def coerce(input)
  if input.nil? || input.is_a?(::Float)
    input
  elsif input.is_a?(::Integer)
    input.to_f
  else
    raise ArgumentError.new("Could not coerce '#{input.inspect}' to #{name}")
  end
end
coerced?(input) click to toggle source
# File lib/avromatic/model/types/float_type.rb, line 38
def coerced?(input)
  input.nil? || input.is_a?(::Float)
end
coercible?(input) click to toggle source
# File lib/avromatic/model/types/float_type.rb, line 34
def coercible?(input)
  input.nil? || input.is_a?(::Float) || input.is_a?(::Integer)
end
input_classes() click to toggle source
# File lib/avromatic/model/types/float_type.rb, line 16
def input_classes
  INPUT_CLASSES
end
name() click to toggle source
# File lib/avromatic/model/types/float_type.rb, line 20
def name
  'float'
end
referenced_model_classes() click to toggle source
# File lib/avromatic/model/types/float_type.rb, line 46
def referenced_model_classes
  EMPTY_ARRAY
end
serialize(value, _strict) click to toggle source
# File lib/avromatic/model/types/float_type.rb, line 42
def serialize(value, _strict)
  value
end
value_classes() click to toggle source
# File lib/avromatic/model/types/float_type.rb, line 12
def value_classes
  VALUE_CLASSES
end