Class: GraphQL::Query::Executor
- Inherits:
- 
      Object
      
        - Object
- GraphQL::Query::Executor
 
- Defined in:
- lib/graphql/query/executor.rb
Defined Under Namespace
Classes: PropagateNull
Instance Attribute Summary collapse
- 
  
    
      #query  ⇒ GraphQL::Query 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    The query being executed. 
Instance Method Summary collapse
- 
  
    
      #initialize(query)  ⇒ Executor 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of Executor. 
- 
  
    
      #result  ⇒ Hash 
    
    
  
  
  
  
  
  
  
  
  
    Evaluate #operation_name on #query. 
Constructor Details
#initialize(query) ⇒ Executor
Returns a new instance of Executor.
| 10 11 12 | # File 'lib/graphql/query/executor.rb', line 10 def initialize(query) @query = query end | 
Instance Attribute Details
#query ⇒ GraphQL::Query (readonly)
Returns the query being executed.
| 8 9 10 | # File 'lib/graphql/query/executor.rb', line 8 def query @query end | 
Instance Method Details
#result ⇒ Hash
Evaluate GraphQL::Query#operation_name on #query. Handle ExecutionErrors by putting them in the “errors” key.
| 17 18 19 20 21 22 | # File 'lib/graphql/query/executor.rb', line 17 def result execute rescue GraphQL::ExecutionError => err query.context.errors << err {"errors" => [err.to_h]} end |