Module: GraphQL::Schema::Member::CachedGraphQLDefinition Private

Included in:
Argument, Field, Interface::DefinitionMethods, List, GraphQL::Schema::Member, NonNull
Defined in:
lib/graphql/schema/member/cached_graphql_definition.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Adds a layer of caching over user-supplied .to_graphql methods. Users override .to_graphql, but all runtime code should use .graphql_definition.

See Also:

  • classes that extend this, eg {Schema::Object}

Instance Method Summary collapse

Instance Method Details

#graphql_definitionObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

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



14
15
16
# File 'lib/graphql/schema/member/cached_graphql_definition.rb', line 14

def graphql_definition
  @graphql_definition ||= to_graphql
end

#initialize_copy(original) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

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



19
20
21
22
# File 'lib/graphql/schema/member/cached_graphql_definition.rb', line 19

def initialize_copy(original)
  super
  @graphql_definition = nil
end