Class: GraphQL::Query::Executor
- Inherits:
-
Object
- Object
- GraphQL::Query::Executor
- Defined in:
- lib/graphql/query/executor.rb
Defined Under Namespace
Classes: OperationNameMissingError
Instance Attribute Summary collapse
-
#operation_name ⇒ Object
readonly
Returns the value of attribute operation_name.
-
#query ⇒ Object
readonly
Returns the value of attribute query.
Instance Method Summary collapse
-
#initialize(query, operation_name) ⇒ Executor
constructor
A new instance of Executor.
- #result ⇒ Object
Constructor Details
#initialize(query, operation_name) ⇒ Executor
Returns a new instance of Executor.
12 13 14 15 |
# File 'lib/graphql/query/executor.rb', line 12 def initialize(query, operation_name) @query = query @operation_name = operation_name end |
Instance Attribute Details
#operation_name ⇒ Object (readonly)
Returns the value of attribute operation_name.
11 12 13 |
# File 'lib/graphql/query/executor.rb', line 11 def operation_name @operation_name end |
#query ⇒ Object (readonly)
Returns the value of attribute query.
11 12 13 |
# File 'lib/graphql/query/executor.rb', line 11 def query @query end |
Instance Method Details
#result ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/graphql/query/executor.rb', line 17 def result {"data" => execute } rescue OperationNameMissingError => err {"errors" => [{"message" => err.}]} rescue StandardError => err query.debug && raise(err) = "Something went wrong during query execution: #{err}" # \n #{err.backtrace.join("\n ")}" {"errors" => [{"message" => }]} end |