class GraphQL::Types::Int
See Types::BigInt for handling integers outside 32-bit range.
Constants
- MAX
- MIN
Public Class Methods
Source
# File lib/graphql/types/int.rb, line 13 def self.coerce_input(value, ctx) return if !value.is_a?(Integer) if value >= MIN && value <= MAX value else err = GraphQL::IntegerDecodingError.new(value) ctx.schema.type_error(err, ctx) end end
Source
# File lib/graphql/types/int.rb, line 24 def self.coerce_result(value, ctx) value = value.to_i if value >= MIN && value <= MAX value else err = GraphQL::IntegerEncodingError.new(value, context: ctx) ctx.schema.type_error(err, ctx) end end