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_field`s. 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.
159 160 161 162 163 164 |
# File 'lib/graphql/relay/mutation.rb', line 159 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.
167 168 169 |
# File 'lib/graphql/relay/mutation.rb', line 167 def mutation @mutation end |
Instance Attribute Details
#client_mutation_id ⇒ Object (readonly)
Returns the value of attribute client_mutation_id.
158 159 160 |
# File 'lib/graphql/relay/mutation.rb', line 158 def client_mutation_id @client_mutation_id end |
Class Method Details
.define_subclass(mutation_defn) ⇒ Object
170 171 172 173 174 175 176 |
# File 'lib/graphql/relay/mutation.rb', line 170 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 |