class GraphQL::InterfaceType
@api deprecated
Attributes
Public Class Methods
GraphQL::BaseType::new
# File lib/graphql/interface_type.rb, line 13 def initialize super @fields = {} @orphan_types = [] @resolve_type_proc = nil end
Public Instance Methods
These fields don't have instrumenation applied @see [Schema#get_fields] Get fields with instrumentation @return [Array<GraphQL::Field>] All fields on this type
# File lib/graphql/interface_type.rb, line 46 def all_fields fields.values end
@return [GraphQL::Field] The defined field for `field_name`
# File lib/graphql/interface_type.rb, line 39 def get_field(field_name) fields[field_name] end
Get a possible type of this {InterfaceType} by type name @param type_name [String] @param ctx [GraphQL::Query::Context] The context for the current query @return [GraphQL::ObjectType, nil] The type named `type_name` if it exists and implements this {InterfaceType}, (else `nil`)
# File lib/graphql/interface_type.rb, line 54 def get_possible_type(type_name, ctx) type = ctx.query.get_type(type_name) type if type && ctx.query.warden.possible_types(self).include?(type) end
GraphQL::BaseType#initialize_copy
# File lib/graphql/interface_type.rb, line 20 def initialize_copy(other) super @fields = other.fields.dup @orphan_types = other.orphan_types.dup end
# File lib/graphql/interface_type.rb, line 26 def kind GraphQL::TypeKinds::INTERFACE end
Check if a type is a possible type of this {InterfaceType} @param type [String, GraphQL::BaseType] Name of the type or a type definition @param ctx [GraphQL::Query::Context] The context for the current query @return [Boolean] True if the `type` exists and is a member of this {InterfaceType}, (else `nil`)
# File lib/graphql/interface_type.rb, line 63 def possible_type?(type, ctx) type_name = type.is_a?(String) ? type : type.graphql_name !get_possible_type(type_name, ctx).nil? end
# File lib/graphql/interface_type.rb, line 30 def resolve_type(value, ctx) ctx.query.resolve_type(self, value) end
# File lib/graphql/interface_type.rb, line 34 def resolve_type=(resolve_type_callable) @resolve_type_proc = resolve_type_callable end
# File lib/graphql/interface_type.rb, line 68 def type_membership_class @type_membership_class || GraphQL::Schema::TypeMembership end