Method: GraphQL::Types::Int.coerce_input

Defined in:
lib/graphql/types/int.rb

.coerce_input(value, ctx) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/graphql/types/int.rb', line 12

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