Class: GraphQL::Relay::Mutation::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/graphql/relay/mutation.rb

Overview

Use this when the mutation's return type was generated from return_fields. It delegates field lookups to the hash returned from resolve.

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client_mutation_id:, result:) ⇒ Result

Returns a new instance of Result.



203
204
205
206
207
208
# File 'lib/graphql/relay/mutation.rb', line 203

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

.mutationObject

Returns the value of attribute mutation.



211
212
213
# File 'lib/graphql/relay/mutation.rb', line 211

def mutation
  @mutation
end

Instance Attribute Details

#client_mutation_idObject (readonly)

Returns the value of attribute client_mutation_id.



202
203
204
# File 'lib/graphql/relay/mutation.rb', line 202

def client_mutation_id
  @client_mutation_id
end

Class Method Details

.define_subclass(mutation_defn) ⇒ Object



214
215
216
217
218
219
220
# File 'lib/graphql/relay/mutation.rb', line 214

def self.define_subclass(mutation_defn)
  subclass = Class.new(self) do
    attr_accessor(*mutation_defn.return_type.all_fields.map(&:name))
    self.mutation = mutation_defn
  end
  subclass
end