Class: GraphQL::GraphQLNonNull

Inherits:
Object
  • Object
show all
Includes:
GraphQLInputType, GraphQLOutputType, GraphQLType
Defined in:
lib/graphql/type/non_null.rb

Constant Summary collapse

NESTING_ERROR =
'Cannot nest NonNull inside NonNull'

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from GraphQLType

#+@

Constructor Details

#initialize(of_type) ⇒ GraphQLNonNull

Returns a new instance of GraphQLNonNull.

Raises:



13
14
15
16
17
# File 'lib/graphql/type/non_null.rb', line 13

def initialize(of_type)
  raise "Expecting #{GraphQLType}, got #{of_type.class}." unless of_type.is_a?(GraphQLType)
  raise NESTING_ERROR if of_type.is_a?(GraphQLNonNull)
  @of_type = of_type
end

Instance Attribute Details

#of_typeObject (readonly)

Returns the value of attribute of_type.



11
12
13
# File 'lib/graphql/type/non_null.rb', line 11

def of_type
  @of_type
end

Instance Method Details

#to_sObject



19
20
21
# File 'lib/graphql/type/non_null.rb', line 19

def to_s
  of_type.to_s + '!'
end