Class: GraphQL::NonNullType

Inherits:
ObjectType show all
Defined in:
lib/graphql/non_null_type.rb

Overview

A non-null type wraps another type.

See TypeKind#unwrap for accessing the modified type

Instance Attribute Summary collapse

Attributes inherited from ObjectType

#description, #fields, #interfaces

Instance Method Summary collapse

Methods inherited from ObjectType

#==, #to_s

Methods included from DefinitionHelpers::DefinedByConfig

included

Methods included from DefinitionHelpers::NonNullWithBang

#!

Constructor Details

#initialize(of_type:) ⇒ NonNullType

Returns a new instance of NonNullType.



6
7
8
# File 'lib/graphql/non_null_type.rb', line 6

def initialize(of_type:)
  @of_type = of_type
end

Instance Attribute Details

#of_typeObject (readonly)

Returns the value of attribute of_type.



5
6
7
# File 'lib/graphql/non_null_type.rb', line 5

def of_type
  @of_type
end

Instance Method Details

#coerce(value) ⇒ Object



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

def coerce(value)
  of_type.coerce(value)
end

#kindObject



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

def kind
  GraphQL::TypeKinds::NON_NULL
end

#nameObject



10
11
12
# File 'lib/graphql/non_null_type.rb', line 10

def name
  "Non-Null"
end