class GraphQL::Cache::Field

Custom field class implementation to allow for cache config keyword parameters

Public Class Methods

new( *args, cache: false, **kwargs, &block ) click to toggle source

Overriden to take a new cache keyword argument

Calls superclass method
# File lib/graphql/cache/field.rb, line 9
def initialize(
  *args,
  cache: false,
  **kwargs,
  &block
)
  @cache_config = cache
  super(*args, **kwargs, &block)
end

Public Instance Methods

to_graphql() click to toggle source

Overriden to provide custom cache config to internal definition

Calls superclass method
# File lib/graphql/cache/field.rb, line 20
def to_graphql
  field_defn = super # Returns a GraphQL::Field
  field_defn.metadata[:cache] = @cache_config
  field_defn
end