Class: GraphQL::Relay::Mutation::Result
- Inherits:
-
Object
- Object
- GraphQL::Relay::Mutation::Result
- 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
-
.mutation ⇒ Object
Returns the value of attribute mutation.
Instance Attribute Summary collapse
-
#client_mutation_id ⇒ Object
readonly
Returns the value of attribute client_mutation_id.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(client_mutation_id:, result:) ⇒ Result
constructor
A new instance of Result.
Constructor Details
#initialize(client_mutation_id:, result:) ⇒ Result
Returns a new instance of Result.
152 153 154 155 156 157 |
# File 'lib/graphql/relay/mutation.rb', line 152 def initialize(client_mutation_id:, result:) @client_mutation_id = client_mutation_id result.each do |key, value| self.public_send("#{key}=", value) end end |
Class Attribute Details
.mutation ⇒ Object
Returns the value of attribute mutation.
160 161 162 |
# File 'lib/graphql/relay/mutation.rb', line 160 def mutation @mutation end |
Instance Attribute Details
#client_mutation_id ⇒ Object (readonly)
Returns the value of attribute client_mutation_id.
151 152 153 |
# File 'lib/graphql/relay/mutation.rb', line 151 def client_mutation_id @client_mutation_id end |
Class Method Details
.define_subclass(mutation_defn) ⇒ Object
163 164 165 166 167 168 169 |
# File 'lib/graphql/relay/mutation.rb', line 163 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 |