Module: GraphQL::Relay::EdgesInstrumentation

Defined in:
lib/graphql/relay/edges_instrumentation.rb

Defined Under Namespace

Classes: EdgesResolve

Class Method Summary collapse

Class Method Details

.instrument(type, field) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/graphql/relay/edges_instrumentation.rb', line 5

def self.instrument(type, field)
  if field.edges?
    edges_resolve = EdgesResolve.new(edge_class: field.edge_class, resolve: field.resolve_proc)
    edges_lazy_resolve = EdgesResolve.new(edge_class: field.edge_class, resolve: field.lazy_resolve_proc)

    field.redefine(
      resolve: edges_resolve,
      lazy_resolve: edges_lazy_resolve,
    )
  else
    field
  end
end