Class: GraphQL::Types::Boolean

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

Constant Summary

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

#path

Methods included from Schema::Member::RelayShortcuts

#connection_type, #connection_type_class, #edge_type, #edge_type_class

Methods included from Schema::Member::Scoped

#scope_items

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



7
8
9
# File 'lib/graphql/types/boolean.rb', line 7

def self.coerce_input(value, _ctx)
  (value == true || value == false) ? value : nil
end

.coerce_result(value, _ctx) ⇒ Object



11
12
13
# File 'lib/graphql/types/boolean.rb', line 11

def self.coerce_result(value, _ctx)
  !!value
end