Class: GraphqlDevise::MountMethod::OperationPreparers::MutationFieldSetter

Inherits:
Object
  • Object
show all
Defined in:
lib/graphql_devise/mount_method/operation_preparers/mutation_field_setter.rb

Instance Method Summary collapse

Constructor Details

#initialize(authenticatable_type) ⇒ MutationFieldSetter

Returns a new instance of MutationFieldSetter.



7
8
9
# File 'lib/graphql_devise/mount_method/operation_preparers/mutation_field_setter.rb', line 7

def initialize(authenticatable_type)
  @authenticatable_type = authenticatable_type
end

Instance Method Details

#call(mutation, authenticatable: true) ⇒ Object



11
12
13
14
15
16
# File 'lib/graphql_devise/mount_method/operation_preparers/mutation_field_setter.rb', line 11

def call(mutation, authenticatable: true)
  return mutation unless authenticatable

  mutation.field(:authenticatable, @authenticatable_type, null: false)
  mutation
end