Class: GraphQL::Interface

Inherits:
ObjectType show all
Defined in:
lib/graph_ql/interface.rb

Instance Method Summary collapse

Methods inherited from ObjectType

#fields, #fields=, #initialize, #inspect, #interfaces

Methods included from Definable

#attr_definable

Methods included from NonNullWithBang

#!

Constructor Details

This class inherits a constructor from GraphQL::ObjectType

Instance Method Details

#kindObject



2
3
4
# File 'lib/graph_ql/interface.rb', line 2

def kind
  GraphQL::TypeKinds::INTERFACE
end

#possible_typesObject



6
7
8
# File 'lib/graph_ql/interface.rb', line 6

def possible_types
  @possible_types ||= []
end

#resolve_type(object) ⇒ Object

Might have to override this in your own interface



11
12
13
# File 'lib/graph_ql/interface.rb', line 11

def resolve_type(object)
  @possible_types.find {|t| t.name == object.class.name }
end

#to_sObject



15
16
17
# File 'lib/graph_ql/interface.rb', line 15

def to_s
  "<GraphQL::Interface #{name}>"
end