module GraphQL::Schema::Member::CachedGraphQLDefinition

Adds a layer of caching over user-supplied `.to_graphql` methods. Users override `.to_graphql`, but all runtime code should use `.graphql_definition`. @api private @see concrete classes that extend this, eg {Schema::Object}

Public Instance Methods

graphql_definition() click to toggle source

A cached result of {.to_graphql}. It's cached here so that user-overridden {.to_graphql} implementations are also cached

# File lib/graphql/schema/member/cached_graphql_definition.rb, line 13
def graphql_definition
  @graphql_definition ||= to_graphql
end
initialize_copy(original) click to toggle source

Wipe out the cached #graphql_definition so that `.to_graphql` will be called again.

Calls superclass method
# File lib/graphql/schema/member/cached_graphql_definition.rb, line 18
def initialize_copy(original)
  super
  @graphql_definition = nil
end