Class: GraphQL::UnionType

Inherits:
BaseType show all
Includes:
BaseType::HasPossibleTypes
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

Constant Summary

Constants included from BaseType::HasPossibleTypes

BaseType::HasPossibleTypes::DEFAULT_RESOLVE_TYPE

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from BaseType::HasPossibleTypes

#resolve_type, #resolve_type=

Methods inherited from BaseType

#==, #coerce_input, #resolve_type, #to_list_type, #to_non_null_type, #to_s, #unwrap, #valid_input?, #validate_input

Methods included from Define::InstanceDefinable

included

Methods included from Define::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

Instance Method Details

#include?(child_type_defn) ⇒ Boolean

Returns:

  • (Boolean)


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

def include?(child_type_defn)
  possible_types.include?(child_type_defn)
end

#kindObject



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

def kind
  GraphQL::TypeKinds::UNION
end