class GraphQL::Relay::Mutation::Result
Use this when the mutation's return type was generated from `return_field`s. It delegates field lookups to the hash returned from `resolve`. @api private
Attributes
mutation[RW]
client_mutation_id[R]
Public Class Methods
define_subclass(mutation_defn)
click to toggle source
Build a subclass whose instances have a method for each of `mutation_defn`'s `return_field`s @param mutation_defn [GraphQL::Relay::Mutation] @return [Class]
# File lib/graphql/relay/mutation/result.rb, line 24 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
new(client_mutation_id:, result:)
click to toggle source
# File lib/graphql/relay/mutation/result.rb, line 9 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