Class: GraphQL::Query::SerialExecution::ExecutionContext
- Inherits:
-
Object
- Object
- GraphQL::Query::SerialExecution::ExecutionContext
- Defined in:
- lib/graphql/query/serial_execution/execution_context.rb
Instance Attribute Summary collapse
-
#query ⇒ Object
readonly
Returns the value of attribute query.
-
#schema ⇒ Object
readonly
Returns the value of attribute schema.
-
#strategy ⇒ Object
readonly
Returns the value of attribute strategy.
Instance Method Summary collapse
- #add_error(err) ⇒ Object
- #get_field(type, irep_node) ⇒ Object
- #get_fragment(name) ⇒ Object
- #get_type(type) ⇒ Object
-
#initialize(query, strategy) ⇒ ExecutionContext
constructor
A new instance of ExecutionContext.
Constructor Details
#initialize(query, strategy) ⇒ ExecutionContext
Returns a new instance of ExecutionContext.
7 8 9 10 11 |
# File 'lib/graphql/query/serial_execution/execution_context.rb', line 7 def initialize(query, strategy) @query = query @schema = query.schema @strategy = strategy end |
Instance Attribute Details
#query ⇒ Object (readonly)
Returns the value of attribute query.
5 6 7 |
# File 'lib/graphql/query/serial_execution/execution_context.rb', line 5 def query @query end |
#schema ⇒ Object (readonly)
Returns the value of attribute schema.
5 6 7 |
# File 'lib/graphql/query/serial_execution/execution_context.rb', line 5 def schema @schema end |
#strategy ⇒ Object (readonly)
Returns the value of attribute strategy.
5 6 7 |
# File 'lib/graphql/query/serial_execution/execution_context.rb', line 5 def strategy @strategy end |
Instance Method Details
#add_error(err) ⇒ Object
26 27 28 |
# File 'lib/graphql/query/serial_execution/execution_context.rb', line 26 def add_error(err) @query.context.errors << err end |
#get_field(type, irep_node) ⇒ Object
21 22 23 24 |
# File 'lib/graphql/query/serial_execution/execution_context.rb', line 21 def get_field(type, irep_node) # fall back for dynamic fields (eg __typename) irep_node.definitions[type] || @schema.get_field(type, irep_node.definition_name) || raise("No field found on #{type.name} for '#{irep_node.definition_name}' (#{irep_node.ast_node.name})") end |
#get_fragment(name) ⇒ Object
17 18 19 |
# File 'lib/graphql/query/serial_execution/execution_context.rb', line 17 def get_fragment(name) @query.fragments[name] end |
#get_type(type) ⇒ Object
13 14 15 |
# File 'lib/graphql/query/serial_execution/execution_context.rb', line 13 def get_type(type) @schema.types[type] end |