Class: GraphQL::Cache::Field
- Inherits:
-
Schema::Field
- Object
- Schema::Field
- GraphQL::Cache::Field
- Defined in:
- lib/graphql/cache/field.rb
Instance Method Summary collapse
-
#initialize(*args, cache: false, **kwargs, &block) ⇒ Field
constructor
Override #initialize to take a new argument:.
- #to_graphql ⇒ Object
Constructor Details
#initialize(*args, cache: false, **kwargs, &block) ⇒ Field
Override #initialize to take a new argument:
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/graphql/cache/field.rb', line 7 def initialize( *args, cache: false, **kwargs, &block ) @cache_config = if cache.is_a? Hash cache else { cache: cache } end super(*args, **kwargs, &block) end |
Instance Method Details
#to_graphql ⇒ Object
21 22 23 24 25 |
# File 'lib/graphql/cache/field.rb', line 21 def to_graphql field_defn = super # Returns a GraphQL::Field field_defn.[:cache] = @cache_config field_defn end |