Class: GraphQL::Query::Context::FieldResolutionContext
- Inherits:
-
Object
- Object
- GraphQL::Query::Context::FieldResolutionContext
- Extended by:
- Forwardable
- Defined in:
- lib/graphql/query/context.rb
Instance Attribute Summary collapse
-
#irep_node ⇒ Object
readonly
Returns the value of attribute irep_node.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#add_error(error) ⇒ void
Add error to current field resolution.
-
#ast_node ⇒ GraphQL::Language::Nodes::Field
The AST node for the currently-executing field.
-
#initialize(context:, path:, irep_node:) ⇒ FieldResolutionContext
constructor
A new instance of FieldResolutionContext.
Constructor Details
#initialize(context:, path:, irep_node:) ⇒ FieldResolutionContext
Returns a new instance of FieldResolutionContext.
71 72 73 74 75 |
# File 'lib/graphql/query/context.rb', line 71 def initialize(context:, path:, irep_node:) @context = context @path = path @irep_node = irep_node end |
Instance Attribute Details
#irep_node ⇒ Object (readonly)
Returns the value of attribute irep_node.
69 70 71 |
# File 'lib/graphql/query/context.rb', line 69 def irep_node @irep_node end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
69 70 71 |
# File 'lib/graphql/query/context.rb', line 69 def path @path end |
Instance Method Details
#add_error(error) ⇒ void
This method returns an undefined value.
Add error to current field resolution.
87 88 89 90 91 92 93 94 95 96 |
# File 'lib/graphql/query/context.rb', line 87 def add_error(error) unless error.is_a?(ExecutionError) raise TypeError, "expected error to be a ExecutionError, but was #{error.class}" end error.ast_node ||= irep_node.ast_node error.path ||= path errors << error nil end |
#ast_node ⇒ GraphQL::Language::Nodes::Field
Returns The AST node for the currently-executing field.
80 81 82 |
# File 'lib/graphql/query/context.rb', line 80 def ast_node @irep_node.ast_node end |