Class: GraphQL::Query::Executor

Inherits:
Object
  • Object
show all
Defined in:
lib/graphql/query/executor.rb

Defined Under Namespace

Classes: PropagateNull

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(query) ⇒ Executor


11
12
13
# File 'lib/graphql/query/executor.rb', line 11

def initialize(query)
  @query = query
end

Instance Attribute Details

#queryGraphQL::Query (readonly)


9
10
11
# File 'lib/graphql/query/executor.rb', line 9

def query
  @query
end

Instance Method Details

#resultHash

Evaluate GraphQL::Query#operation_name on #query. Handle ExecutionErrors by putting them in the "errors" key.


18
19
20
21
22
23
# File 'lib/graphql/query/executor.rb', line 18

def result
  execute
rescue GraphQL::ExecutionError => err
  query.context.errors << err
  {"errors" => [err.to_h]}
end