Class: GraphQL::InterfaceType
- Inherits:
-
ObjectType
- Object
- ObjectType
- GraphQL::InterfaceType
- Defined in:
- lib/graph_ql/interface_type.rb
Overview
A collection of types which implement the same fields
Instance Method Summary collapse
- #kind ⇒ Object
-
#possible_types ⇒ Array<GraphQL::ObjectType>
Types which declare that they implement this interface.
-
#resolve_type(object) ⇒ GraphQL::ObjectType
Return the implementing type for ‘object`.
Methods inherited from ObjectType
#==, #fields, #fields=, #initialize, #interfaces, #to_s
Methods included from DefinitionHelpers::Definable
Methods included from DefinitionHelpers::NonNullWithBang
Constructor Details
This class inherits a constructor from GraphQL::ObjectType
Instance Method Details
#kind ⇒ Object
15 16 17 |
# File 'lib/graph_ql/interface_type.rb', line 15 def kind GraphQL::TypeKinds::INTERFACE end |
#possible_types ⇒ Array<GraphQL::ObjectType>
Returns Types which declare that they implement this interface.
20 21 22 |
# File 'lib/graph_ql/interface_type.rb', line 20 def possible_types @possible_types ||= [] end |
#resolve_type(object) ⇒ GraphQL::ObjectType
Return the implementing type for ‘object`. The default implementation assumes that there’s a type with the same name as ‘object.class.name`. Maybe you’ll need to override this in your own interfaces!
30 31 32 |
# File 'lib/graph_ql/interface_type.rb', line 30 def resolve_type(object) @possible_types.find {|t| t.name == object.class.name } end |