Class: GraphQL::UnionType

Inherits:
Object
  • Object
show all
Includes:
DefinitionHelpers::DefinedByConfig, DefinitionHelpers::NonNullWithBang
Defined in:
lib/graphql/union_type.rb

Overview

A collection of ObjectTypes

Examples:

a union of types


PetUnion = GraphQL::UnionType.define do
  name "Pet"
  description "Animals that live in your house"
  possible_types [DogType, CatType, FishType]
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DefinitionHelpers::DefinedByConfig

included

Methods included from DefinitionHelpers::NonNullWithBang

#!

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



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

def description
  @description
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#possible_typesObject

Returns the value of attribute possible_types.



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

def possible_types
  @possible_types
end

#resolve_type(object) ⇒ Object

See Also:

  • GraphQL::UnionType.{InterfaceType{InterfaceType#resolve_type}


22
23
24
# File 'lib/graphql/union_type.rb', line 22

def resolve_type
  @resolve_type
end

Instance Method Details

#kindObject



17
18
19
# File 'lib/graphql/union_type.rb', line 17

def kind
  GraphQL::TypeKinds::UNION
end