Module: GraphQL::Client::Schema::BaseType

Included in:
EnumType, IncludeDirective, InterfaceType, ListType, NonNullType, PossibleTypes, ScalarType, SkipDirective, UnionType
Defined in:
lib/graphql/client/schema/base_type.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#schema_moduleObject

Internal: Get owner schema Module container.


11
12
13
# File 'lib/graphql/client/schema/base_type.rb', line 11

def schema_module
  @schema_module
end

#typeObject (readonly)

Public: Get associated GraphQL::BaseType with for this class.


8
9
10
# File 'lib/graphql/client/schema/base_type.rb', line 8

def type
  @type
end

Instance Method Details

#cast(value, errors) ⇒ Object

Internal: Cast JSON value to wrapped value.

value - JSON value errors - Errors instance

Returns BaseType instance.


19
20
21
# File 'lib/graphql/client/schema/base_type.rb', line 19

def cast(value, errors)
  raise NotImplementedError, "subclasses must implement #cast(value, errors)"
end

#to_list_typeObject

Internal: Get list wrapper of this type class.

Returns ListType instance.


33
34
35
# File 'lib/graphql/client/schema/base_type.rb', line 33

def to_list_type
  @list_type ||= ListType.new(self)
end

#to_non_null_typeObject

Internal: Get non-nullable wrapper of this type class.

Returns NonNullType instance.


26
27
28
# File 'lib/graphql/client/schema/base_type.rb', line 26

def to_non_null_type
  @null_type ||= NonNullType.new(self)
end