Class: GraphQL::ResultCache::FieldInstrument

Inherits:
Object
  • Object
show all
Defined in:
lib/graphql/result_cache/field_instrument.rb

Instance Method Summary collapse

Instance Method Details

#instrument(_type, field) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/graphql/result_cache/field_instrument.rb', line 9

def instrument _type, field
  return field unless field.[:result_cache]

  cached_resolve_proc = cached_resolve(field)
  field.redefine do
    resolve(cached_resolve_proc)
    type(field.type.of_type) if !::GraphQL::ResultCache.introspection? && field.type.non_null?
  end
end