Class: GraphQL::InterfaceType

Inherits:
BaseType
  • Object
show all
Includes:
BaseType::HasPossibleTypes
Defined in:
lib/graphql/interface_type.rb

Overview

A collection of types which implement the same fields

Examples:

An interface with three required fields

DeviceInterface = GraphQL::InterfaceType.define do
  name("Device")
  description("Hardware devices for computing")

  field :ram, types.String
  field :processor, ProcessorType
  field :release_year, types.Int
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

#include?, #resolve_type, #resolve_type=

Methods inherited from BaseType

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

Methods included from DefinitionHelpers::DefinedByConfig

included

Methods included from DefinitionHelpers::NonNullWithBang

#!

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



16
17
18
# File 'lib/graphql/interface_type.rb', line 16

def description
  @description
end

#fieldsObject

Returns the value of attribute fields.



16
17
18
# File 'lib/graphql/interface_type.rb', line 16

def fields
  @fields
end

#nameObject

Returns the value of attribute name.



16
17
18
# File 'lib/graphql/interface_type.rb', line 16

def name
  @name
end

Instance Method Details

#kindObject



18
19
20
# File 'lib/graphql/interface_type.rb', line 18

def kind
  GraphQL::TypeKinds::INTERFACE
end

#possible_typesArray<GraphQL::ObjectType>

Returns Types which declare that they implement this interface.

Returns:



23
24
25
# File 'lib/graphql/interface_type.rb', line 23

def possible_types
  @possible_types ||= []
end