Module: GraphQL::Types::Relay::NodeBehaviors

Included in:
Node
Defined in:
lib/graphql/types/relay/node_behaviors.rb

Overview

-- @requires_ancestor: GraphQL::Schema::Object

Defined Under Namespace

Modules: ClassMethods, ExecutionMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(child_module) ⇒ Object

: (GraphQL::Schema::Member::interface_definition child_module) -> void



12
13
14
15
16
17
# File 'lib/graphql/types/relay/node_behaviors.rb', line 12

def self.included(child_module)
  child_module.extend(ClassMethods)
  child_module.extend(ExecutionMethods)
  child_module.description("An object with an ID.")
  child_module.field(:id, ID, null: false, description: "ID of the object.", resolver_method: :default_global_id, resolve_each: :default_global_id)
end

Instance Method Details

#default_global_id ⇒ Object

: -> String



20
21
22
23
# File 'lib/graphql/types/relay/node_behaviors.rb', line 20

def default_global_id
  node_class = self.class #: as GraphQL::Types::Relay::NodeBehaviors::ExecutionMethods
  node_class.default_global_id(object, context)
end