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_name) ⇒ Object
-
#initialize(query, strategy) ⇒ ExecutionContext
constructor
A new instance of ExecutionContext.
- #possible_types(type) ⇒ Object
Constructor Details
#initialize(query, strategy) ⇒ ExecutionContext
Returns a new instance of ExecutionContext.
7 8 9 10 11 12 |
# File 'lib/graphql/query/serial_execution/execution_context.rb', line 7 def initialize(query, strategy) @query = query @schema = query.schema @strategy = strategy @warden = query.warden 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
31 32 33 |
# File 'lib/graphql/query/serial_execution/execution_context.rb', line 31 def add_error(err) @query.context.errors << err end |
#get_field(type, irep_node) ⇒ Object
22 23 24 25 |
# File 'lib/graphql/query/serial_execution/execution_context.rb', line 22 def get_field(type, irep_node) # fall back for dynamic fields (eg __typename) irep_node.definitions[type] || @warden.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
18 19 20 |
# File 'lib/graphql/query/serial_execution/execution_context.rb', line 18 def get_fragment(name) @query.fragments[name] end |
#get_type(type_name) ⇒ Object
14 15 16 |
# File 'lib/graphql/query/serial_execution/execution_context.rb', line 14 def get_type(type_name) @warden.get_type(type_name) end |
#possible_types(type) ⇒ Object
27 28 29 |
# File 'lib/graphql/query/serial_execution/execution_context.rb', line 27 def possible_types(type) @warden.possible_types(type) end |