Class: GraphQL::Types::BigInt

Inherits:
Schema::Scalar show all
Defined in:
lib/graphql/types/big_int.rb

Constant Summary

Constants included from Schema::Member::HasDirectives

Schema::Member::HasDirectives::NO_DIRECTIVES

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, default_scalar?, kind, specified_by_url, validate_non_null_input

Methods included from Schema::Member::ValidatesInput

#coerce_isolated_input, #coerce_isolated_result, #valid_input?, #valid_isolated_input?, #validate_input

Methods included from Schema::Member::BaseDSLMethods

#accessible?, #authorized?, #default_graphql_name, #description, #graphql_name, #introspection, #introspection?, #mutation, #name, #overridden_graphql_name, #visible?

Methods included from Schema::Member::BaseDSLMethods::ConfigurationExtension

#inherited

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::Scoped

#scope_items

Methods included from Schema::Member::RelayShortcuts

#connection_type, #connection_type_class, #edge_type, #edge_type_class

Methods included from Schema::Member::HasPath

#path

Methods included from Schema::Member::HasAstNode

#ast_node

Methods included from Schema::Member::HasDirectives

#directive, #directives, #remove_directive

Class Method Details

.coerce_input(value, _ctx) ⇒ Object



8
9
10
11
12
# File 'lib/graphql/types/big_int.rb', line 8

def self.coerce_input(value, _ctx)
  value && parse_int(value)
rescue ArgumentError
  nil
end

.coerce_result(value, _ctx) ⇒ Object



14
15
16
# File 'lib/graphql/types/big_int.rb', line 14

def self.coerce_result(value, _ctx)
  value.to_i.to_s
end

.parse_int(value) ⇒ Object



18
19
20
# File 'lib/graphql/types/big_int.rb', line 18

def self.parse_int(value)
  value.is_a?(Numeric) ? value : Integer(value, 10)
end