Class: GraphQL::NonNullType
Overview
Instance Attribute Summary collapse
Attributes inherited from BaseType
#description
Instance Method Summary
collapse
#unwrap
Methods inherited from BaseType
#==, #resolve_type, #to_list_type, #to_non_null_type, #unwrap
included
#!
Constructor Details
#initialize(of_type:) ⇒ NonNullType
Returns a new instance of NonNullType.
9
10
11
|
# File 'lib/graphql/non_null_type.rb', line 9
def initialize(of_type:)
@of_type = of_type
end
|
Instance Attribute Details
#of_type ⇒ Object
Returns the value of attribute of_type.
8
9
10
|
# File 'lib/graphql/non_null_type.rb', line 8
def of_type
@of_type
end
|
Instance Method Details
31
32
33
|
# File 'lib/graphql/non_null_type.rb', line 31
def coerce_input(value)
of_type.coerce_input(value)
end
|
#kind ⇒ Object
35
36
37
|
# File 'lib/graphql/non_null_type.rb', line 35
def kind
GraphQL::TypeKinds::NON_NULL
end
|
#name ⇒ Object
13
14
15
|
# File 'lib/graphql/non_null_type.rb', line 13
def name
"Non-Null"
end
|
#to_s ⇒ Object
39
40
41
|
# File 'lib/graphql/non_null_type.rb', line 39
def to_s
"#{of_type.to_s}!"
end
|
17
18
19
|
# File 'lib/graphql/non_null_type.rb', line 17
def valid_input?(value)
validate_input(value).valid?
end
|
21
22
23
24
25
26
27
28
29
|
# File 'lib/graphql/non_null_type.rb', line 21
def validate_input(value)
if value.nil?
result = GraphQL::Query::InputValidationResult.new
result.add_problem("Expected value to not be null")
result
else
of_type.validate_input(value)
end
end
|