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.
149 150 151 152 153 154 |
# File 'lib/graphql/relay/mutation.rb', line 149 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.
157 158 159 |
# File 'lib/graphql/relay/mutation.rb', line 157 def mutation @mutation end |
Instance Attribute Details
#client_mutation_id ⇒ Object (readonly)
Returns the value of attribute client_mutation_id.
148 149 150 |
# File 'lib/graphql/relay/mutation.rb', line 148 def client_mutation_id @client_mutation_id end |
Class Method Details
.define_subclass(mutation_defn) ⇒ Object
160 161 162 163 164 165 166 |
# File 'lib/graphql/relay/mutation.rb', line 160 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 |