Class: GraphQL::Relay::Mutation::Result Private
- Inherits:
-
Object
- Object
- GraphQL::Relay::Mutation::Result
- Defined in:
- lib/graphql/relay/mutation/result.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Use this when the mutation’s return type was generated from return_field
s.
It delegates field lookups to the hash returned from resolve
.
Class Attribute Summary collapse
-
.mutation ⇒ Object
private
Instance Attribute Summary collapse
-
#client_mutation_id ⇒ Object
readonly
private
Class Method Summary collapse
-
.define_subclass(mutation_defn) ⇒ Class
private
Build a subclass whose instances have a method for each of
mutation_defn
’sreturn_field
s.
Instance Method Summary collapse
-
#initialize(client_mutation_id:, result:) ⇒ Result
constructor
private
A new instance of Result.
Constructor Details
#initialize(client_mutation_id:, result:) ⇒ Result
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Result
10 11 12 13 14 15 |
# File 'lib/graphql/relay/mutation/result.rb', line 10 def initialize(client_mutation_id:, result:) @client_mutation_id = client_mutation_id result && result.each do |key, value| self.public_send("#{key}=", value) end end |
Class Attribute Details
.mutation ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
18 19 20 |
# File 'lib/graphql/relay/mutation/result.rb', line 18 def mutation @mutation end |
Instance Attribute Details
#client_mutation_id ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
9 10 11 |
# File 'lib/graphql/relay/mutation/result.rb', line 9 def client_mutation_id @client_mutation_id end |
Class Method Details
.define_subclass(mutation_defn) ⇒ Class
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Build a subclass whose instances have a method
for each of mutation_defn
’s return_field
s
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/graphql/relay/mutation/result.rb', line 25 def self.define_subclass(mutation_defn) subclass = Class.new(self) do mutation_result_methods = mutation_defn.return_type.all_fields.map do |f| f.property || f.name end attr_accessor(*mutation_result_methods) self.mutation = mutation_defn end subclass end |