Class: GraphQL::Query::NullContext

Inherits:
Context
  • Object
show all
Extended by:
Forwardable
Includes:
Singleton
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

Attributes inherited from Context

#errors, #interpreter, #path, #scoped_context, #value

Instance Method Summary collapse

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

Constructor Details

#initializeNullContext

Returns a new instance of NullContext.



23
24
25
26
27
28
# File 'lib/graphql/query/null_context.rb', line 23

def initialize
  @query = NullQuery.new
  @dataloader = GraphQL::Dataloader::NullDataloader.new
  @schema = NullSchema
  @warden = Schema::Warden::NullWarden.new(context: self, schema: @schema)
end

Instance Attribute Details

#dataloaderObject (readonly)

Returns the value of attribute dataloader.



20
21
22
# File 'lib/graphql/query/null_context.rb', line 20

def dataloader
  @dataloader
end

#queryObject (readonly)

Returns the value of attribute query.



20
21
22
# File 'lib/graphql/query/null_context.rb', line 20

def query
  @query
end

#schemaObject (readonly)

Returns the value of attribute schema.



20
21
22
# File 'lib/graphql/query/null_context.rb', line 20

def schema
  @schema
end

#wardenObject (readonly)

Returns the value of attribute warden.



20
21
22
# File 'lib/graphql/query/null_context.rb', line 20

def warden
  @warden
end

Instance Method Details

#typesObject



30
31
32
# File 'lib/graphql/query/null_context.rb', line 30

def types
  @types ||= Schema::Warden::VisibilityProfile.new(@warden)
end