Class: Rails::GraphQL::Alternative::Query

Inherits:
Object
  • Object
show all
Extended by:
Helpers::WithNamespace
Includes:
Helpers::Instantiable
Defined in:
lib/rails/graphql/alternative/query.rb

Overview

GraphQL Alternative Query

This object acts like a field, but is organized as an object for extended resolvers or really complex fields.

Direct Known Subclasses

Mutation, Subscription

Instance Attribute Summary

Attributes included from Helpers::Instantiable

#event

Class Method Summary collapse

Methods included from Helpers::WithNamespace

namespace, namespaces, set_namespace

Class Method Details

.fieldObject

Stores the underlying field of the object



33
34
35
36
37
# File 'lib/rails/graphql/alternative/query.rb', line 33

def field
  return @field if defined?(@field)
  return define_field unless superclass.instance_variable_defined?(:@field)
  import_field(superclass.field)
end

.i18n_scopeObject

Alias does not work because of the override



28
29
30
# File 'lib/rails/graphql/alternative/query.rb', line 28

def i18n_scope(*)
  type_field_class
end

.inspectObject



39
40
41
# File 'lib/rails/graphql/alternative/query.rb', line 39

def inspect
  defined?(@field) ? @field.inspect : super
end

.type_field_classObject

Returns the type of the field class



23
24
25
# File 'lib/rails/graphql/alternative/query.rb', line 23

def type_field_class
  :query
end