Method: GraphQL::Schema::Member::HasInterfaces#interfaces
- Defined in:
- lib/graphql/schema/member/has_interfaces.rb
#interfaces(context = GraphQL::Query::NullContext.instance) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
param context [Query::Context] If omitted, skip filtering.
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/graphql/schema/member/has_interfaces.rb', line 102 def interfaces(context = GraphQL::Query::NullContext.instance) warden = Warden.from_context(context) visible_interfaces = nil own_interface_type_memberships.each do |type_membership| case type_membership when Schema::TypeMembership if warden.visible_type_membership?(type_membership, context) visible_interfaces ||= [] visible_interfaces << type_membership.abstract_type end when String, Schema::LateBoundType # During initialization, `type_memberships` can hold late-bound types visible_interfaces ||= [] visible_interfaces << type_membership else raise "Invariant: Unexpected type_membership #{type_membership.class}: #{type_membership.inspect}" end end if visible_interfaces visible_interfaces.uniq! visible_interfaces else EmptyObjects::EMPTY_ARRAY end end |