Class: GraphQL::Types::Int
- Inherits:
-
Schema::Scalar
- Object
- Schema::Member
- Schema::Scalar
- GraphQL::Types::Int
- Defined in:
- lib/graphql/types/int.rb
Overview
Constant Summary
- MIN =
-(2**31)
- MAX =
(2**31) - 1
Constants included from Schema::Member::GraphQLTypeNames
Schema::Member::GraphQLTypeNames::Boolean, Schema::Member::GraphQLTypeNames::ID, Schema::Member::GraphQLTypeNames::Int
Class Method Summary collapse
Methods inherited from Schema::Scalar
default_scalar, kind, to_graphql
Methods included from Schema::Member::HasPath
Methods included from Schema::Member::RelayShortcuts
#connection_type, #connection_type_class, #edge_type, #edge_type_class
Methods included from Schema::Member::Scoped
Methods included from Schema::Member::TypeSystemHelpers
#kind, #list?, #non_null?, #to_list_type, #to_non_null_type, #to_type_signature
Methods included from Schema::Member::BaseDSLMethods
#accessible?, #authorized?, #default_graphql_name, #description, #graphql_name, #introspection, #introspection?, #mutation, #name, #overridden_graphql_name, #to_graphql, #visible?
Methods included from Relay::TypeExtensions
#connection_type, #define_connection, #define_edge, #edge_type
Methods included from Schema::Member::CachedGraphQLDefinition
#graphql_definition, #initialize_copy
Class Method Details
.coerce_input(value, _ctx) ⇒ Object
12 13 14 |
# File 'lib/graphql/types/int.rb', line 12 def self.coerce_input(value, _ctx) value.is_a?(Numeric) ? value.to_i : nil end |
.coerce_result(value, ctx) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/graphql/types/int.rb', line 16 def self.coerce_result(value, ctx) value = value.to_i if value >= MIN && value <= MAX value else err = GraphQL::IntegerEncodingError.new(value) ctx.schema.type_error(err, ctx) end end |