class GraphQL::Types::Float
Public Class Methods
(untyped value, GraphQL::Query::Context ctx) → untyped
Source
# File lib/graphql/types/float.rb, line 11 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
(untyped value, GraphQL::Query::Context ctx) → untyped
Source
# File lib/graphql/types/float.rb, line 24 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