Class: Rails::GraphQL::Source::Base
- Inherits:
-
Rails::GraphQL::Source
- Object
- Rails::GraphQL::Source
- Rails::GraphQL::Source::Base
- Defined in:
- lib/rails/graphql/source/base.rb
Direct Known Subclasses
Constant Summary
Constants included from Helpers::WithSchemaFields
Helpers::WithSchemaFields::TYPE_FIELD_CLASS
Constants included from Helpers::InheritedCollection
Helpers::InheritedCollection::DEFAULT_TYPES
Constants included from Helpers::WithCallbacks
Helpers::WithCallbacks::DEFAULT_EVENT_TYPES
Instance Attribute Summary
Attributes included from Helpers::Instantiable
Class Method Summary collapse
-
.input ⇒ Object
Return the GraphQL input type associated with the source.
-
.object ⇒ Object
Return the GraphQL object type associated with the source.
-
.unregister! ⇒ Object
Unregister all objects that this source was providing.
Methods included from Helpers::WithSchemaFields
[], add_field, add_proxy_field, change_field, configure_field, configure_fields, disable_fields, enable_fields, enabled_fields_from, extended, field_names_for, fields_for, fields_for?, find_by_gid, find_field, find_field!, has_field?, import_all, import_all_into, import_into, safe_add_field, type_name_for, validate!
Methods included from Helpers::WithAssignment
assigned?, assigned_class, assigned_to, assigned_to=, extended, register!, safe_assigned_class, valid_assignment?
Methods included from Helpers::Unregisterable
Methods inherited from Rails::GraphQL::Source
attach_fields!, base_name, base_type_class, find_for, find_for!, kind, schemas, step
Methods included from Helpers::InheritedCollection
Methods included from Helpers::WithNamespace
#namespace, #namespaces, #set_namespace
Methods included from Helpers::WithEvents
Methods included from Helpers::WithCallbacks
Methods included from Builder
#build_all, #build_all_sources, #built?, #method_missing, #respond_to_missing?
Class Method Details
.input ⇒ Object
Return the GraphQL input type associated with the source. It will create one if it’s not defined yet. The created class will be added to the ::GraphQL
namespace with the addition of any namespace of the current class
53 54 55 56 57 |
# File 'lib/rails/graphql/source/base.rb', line 53 def input @input ||= create_type(superclass: input_class, gql_name: input_name).tap do |t| t.include(const_get(:InputMethods)) if const_defined?(:InputMethods, false) end end |
.object ⇒ Object
Return the GraphQL object type associated with the source. It will create one if it’s not defined yet. The created class will be added to the ::GraphQL
namespace with the addition of any namespace of the current class
43 44 45 46 47 |
# File 'lib/rails/graphql/source/base.rb', line 43 def object @object ||= create_type(superclass: object_class, gql_name: object_name).tap do |t| t.include(const_get(:ObjectMethods)) if const_defined?(:ObjectMethods, false) end end |
.unregister! ⇒ Object
Unregister all objects that this source was providing
34 35 36 37 |
# File 'lib/rails/graphql/source/base.rb', line 34 def unregister! @object = @input = nil super end |