Module: GraphQL::Field::Resolve

Defined in:
lib/graphql/field/resolve.rb

Overview

Create resolve procs ahead of time based on a GraphQL::Field’s name, property, and hash_key configuration.

Defined Under Namespace

Classes: BuiltInResolve, HashKeyResolve, MethodResolve, NameResolve

Class Method Summary collapse

Class Method Details

.create_proc(field) ⇒ Proc

Returns A resolver for this field, based on its config

Parameters:

Returns:

  • (Proc)

    A resolver for this field, based on its config



10
11
12
13
14
15
16
17
18
# File 'lib/graphql/field/resolve.rb', line 10

def create_proc(field)
  if field.property
    MethodResolve.new(field)
  elsif !field.hash_key.nil?
    HashKeyResolve.new(field.hash_key)
  else
    NameResolve.new(field)
  end
end