Module: GraphQL::Schema::Member::CachedGraphQLDefinition Private
- Included in:
- Argument, Field, Interface::DefinitionMethods, GraphQL::Schema::Member, Wrapper
- 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
.
Instance Method Summary collapse
-
#graphql_definition ⇒ Object
private
A cached result of to_graphql.
-
#initialize_copy(original) ⇒ Object
private
Wipe out the cached graphql_definition so that
.to_graphql
will be called again.
Instance Method Details
#graphql_definition ⇒ 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.
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 |