class GraphQL::Query::Result
A result from {Schema#execute}. It provides the requested data and access to the {Query} and {Query::Context}.
Attributes
query[R]
@return [GraphQL::Query] The query that was executed
to_h[R]
@return [Hash] The resulting hash of “data” and/or “errors”
Public Class Methods
new(query:, values:)
click to toggle source
# File lib/graphql/query/result.rb, line 11 def initialize(query:, values:) @query = query @to_h = values end
Public Instance Methods
==(other)
click to toggle source
A result is equal to another object when:
-
The other object is a Hash whose value matches `result.to_h`
-
The other object is a
Result
whose value matches `result.to_h`
(The query is ignored for comparing result equality.)
@return [Boolean]
Calls superclass method
# File lib/graphql/query/result.rb, line 51 def ==(other) case other when Hash @to_h == other when Query::Result @to_h == other.to_h else super end end
inspect()
click to toggle source
# File lib/graphql/query/result.rb, line 39 def inspect "#<GraphQL::Query::Result @query=... @to_h=#{@to_h}>" end
method_missing(method_name, *args, &block)
click to toggle source
Delegate any hash-like method to the underlying hash.
Calls superclass method
# File lib/graphql/query/result.rb, line 27 def method_missing(method_name, *args, &block) if @to_h.respond_to?(method_name) @to_h.public_send(method_name, *args, &block) else super end end
respond_to_missing?(method_name, include_private = false)
click to toggle source
Calls superclass method
# File lib/graphql/query/result.rb, line 35 def respond_to_missing?(method_name, include_private = false) @to_h.respond_to?(method_name) || super end