Module: GraphQL::Schema::Member::RelayShortcuts Private

Included in:
Interface::DefinitionMethods, GraphQL::Schema::Member
Defined in:
lib/graphql/schema/member/relay_shortcuts.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Instance Method Details

#connection_typeObject

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.


50
51
52
53
54
55
56
57
58
59
# File 'lib/graphql/schema/member/relay_shortcuts.rb', line 50

def connection_type
  @connection_type ||= begin
    conn_name = self.graphql_name + "Connection"
    edge_type_class = self.edge_type
    Class.new(connection_type_class) do
      graphql_name(conn_name)
      edge_type(edge_type_class)
    end
  end
end

#connection_type_class(new_connection_type_class = nil) ⇒ 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.


23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/graphql/schema/member/relay_shortcuts.rb', line 23

def connection_type_class(new_connection_type_class = nil)
  if new_connection_type_class
    @connection_type_class = new_connection_type_class
  else
    # Don't call `ancestor.connection_type_class`
    # because we don't want a fallback from any ancestors --
    # only apply the fallback if _no_ ancestor has a configured value!
    for ancestor in self.ancestors
      if ancestor.respond_to?(:configured_connection_type_class, true) && (ctc = ancestor.configured_connection_type_class)
        return ctc
      end
    end
    Types::Relay::BaseConnection
  end
end

#edge_typeObject

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.


39
40
41
42
43
44
45
46
47
48
# File 'lib/graphql/schema/member/relay_shortcuts.rb', line 39

def edge_type
  @edge_type ||= begin
    edge_name = self.graphql_name + "Edge"
    node_type_class = self
    Class.new(edge_type_class) do
      graphql_name(edge_name)
      node_type(node_type_class)
    end
  end
end

#edge_type_class(new_edge_type_class = nil) ⇒ 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.


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/graphql/schema/member/relay_shortcuts.rb', line 7

def edge_type_class(new_edge_type_class = nil)
  if new_edge_type_class
    @edge_type_class = new_edge_type_class
  else
    # Don't call `ancestor.edge_type_class`
    # because we don't want a fallback from any ancestors --
    # only apply the fallback if _no_ ancestor has a configured value!
    for ancestor in self.ancestors
      if ancestor.respond_to?(:configured_edge_type_class, true) && (etc = ancestor.configured_edge_type_class)
        return etc
      end
    end
    Types::Relay::BaseEdge
  end
end