Class: GraphQL::Query::NullContext
- Extended by:
- Forwardable
- Defined in:
- lib/graphql/query/null_context.rb
Overview
This object can be ctx in places where there is no query
Defined Under Namespace
Classes: NullQuery, NullSchema
Constant Summary
Constants inherited from Context
Context::RUNTIME_METADATA_KEYS, Context::UNSPECIFIED_FETCH_DEFAULT
Instance Attribute Summary collapse
-
#dataloader ⇒ Object
readonly
Returns the value of attribute dataloader.
-
#query ⇒ Object
readonly
Returns the value of attribute query.
-
#schema ⇒ Object
readonly
Returns the value of attribute schema.
-
#warden ⇒ Object
readonly
Returns the value of attribute warden.
Attributes inherited from Context
#errors, #interpreter, #scoped_context, #types, #value
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(schema: NullSchema) ⇒ NullContext
constructor
A new instance of NullContext.
Methods inherited from Context
#[], #[]=, #add_error, #backtrace, #current_path, #delete, #dig, #execution_errors, #fetch, #inspect, #key?, #logger, #namespace, #namespace?, #response_extensions, #scoped, #scoped_merge!, #scoped_set!, #skip, #to_h
Methods included from Schema::Member::HasDataloader
#dataload, #dataload_all, #dataload_association, #dataload_record
Constructor Details
#initialize(schema: NullSchema) ⇒ NullContext
Returns a new instance of NullContext.
29 30 31 32 33 34 35 36 |
# File 'lib/graphql/query/null_context.rb', line 29 def initialize(schema: NullSchema) @query = NullQuery.new @dataloader = GraphQL::Dataloader::NullDataloader.new @schema = schema @warden = Schema::Warden::NullWarden.new(context: self, schema: @schema) @types = @warden.visibility_profile freeze end |
Instance Attribute Details
#dataloader ⇒ Object (readonly)
Returns the value of attribute dataloader.
26 27 28 |
# File 'lib/graphql/query/null_context.rb', line 26 def dataloader @dataloader end |
#query ⇒ Object (readonly)
Returns the value of attribute query.
26 27 28 |
# File 'lib/graphql/query/null_context.rb', line 26 def query @query end |
#schema ⇒ Object (readonly)
Returns the value of attribute schema.
26 27 28 |
# File 'lib/graphql/query/null_context.rb', line 26 def schema @schema end |
#warden ⇒ Object (readonly)
Returns the value of attribute warden.
26 27 28 |
# File 'lib/graphql/query/null_context.rb', line 26 def warden @warden end |
Class Method Details
.instance ⇒ Object
7 8 9 |
# File 'lib/graphql/query/null_context.rb', line 7 def self.instance @instance ||= self.new end |
.instance=(new_inst) ⇒ Object
11 12 13 |
# File 'lib/graphql/query/null_context.rb', line 11 def self.instance=(new_inst) @instance = new_inst end |