26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/graphql/schema/finder.rb', line 26
def find(path)
path = path.split(".")
type_or_directive = path.shift
if type_or_directive.start_with?("@")
directive = schema.directives[type_or_directive[1..-1]]
if directive.nil?
raise MemberNotFoundError, "Could not find directive `#{type_or_directive}` in schema."
end
return directive if path.empty?
find_in_directive(directive, path: path)
else
type = schema.get_type(type_or_directive)
if type.nil?
raise MemberNotFoundError, "Could not find type `#{type_or_directive}` in schema."
end
return type if path.empty?
find_in_type(type, path: path)
end
end
|