class GraphQL::Types::Float
Public Class Methods
Source
# File lib/graphql/types/float.rb, line 9 def self.coerce_input(value, ctx) return if !value.is_a?(Numeric) value = value.to_f if value.finite? value else err = GraphQL::FloatDecodingError.new(value) ctx.schema.type_error(err, ctx) end end
Source
# File lib/graphql/types/float.rb, line 21 def self.coerce_result(value, ctx) value = value.to_f if value.finite? value else err = GraphQL::FloatEncodingError.new(value, context: ctx) ctx.schema.type_error(err, ctx) end end