Module: GraphQL::Schema::Member::HasPath

Included in:
Argument, EnumValue, Field, Interface::DefinitionMethods, GraphQL::Schema::Member, Resolver, Resolver
Defined in:
lib/graphql/schema/member/has_path.rb

Overview

-- @requires_ancestor: Kernel

Instance Method Summary collapse

Instance Method Details

#path ⇒ Object

Returns

  • String — A description of this member's place in the GraphQL schema

:call-seq:

path() -> String

: -> String?



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/graphql/schema/member/has_path.rb', line 18

def path
  member = self #: untyped
  path_str = if member.respond_to?(:graphql_name)
    member.graphql_name
  elsif self.class.respond_to?(:graphql_name)
    # Instances of resolvers
    self.class.graphql_name
  end

  if member.respond_to?(:owner) && member.owner.respond_to?(:path)
    path_str = "#{member.owner.path}.#{path_str}"
  end

  path_str
end