Class: GraphQL::Relay::Edge

Inherits:
ObjectType show all
Defined in:
lib/graphql/relay/edge.rb

Overview

Mostly an internal concern.

Wraps an object as a node, and exposes a connection-specific cursor.

Instance Attribute Summary collapse

Attributes inherited from ObjectType

#fields, #mutation

Attributes inherited from BaseType

#description, #name

Instance Method Summary collapse

Methods inherited from ObjectType

#all_fields, #get_field, #interfaces, #interfaces=, #kind

Methods inherited from BaseType

#==, #coerce_input, #connection_type, #define_connection, #define_edge, #edge_type, #get_field, resolve_related_type, #resolve_type, #to_list_type, #to_non_null_type, #to_s, #unwrap, #valid_input?, #validate_input

Methods included from Define::InstanceDefinable

#define, #definition_proc=, #metadata

Methods included from Define::NonNullWithBang

#!

Constructor Details

#initialize(node, connection) ⇒ Edge


8
9
10
11
# File 'lib/graphql/relay/edge.rb', line 8

def initialize(node, connection)
  @node = node
  @connection = connection
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection


7
8
9
# File 'lib/graphql/relay/edge.rb', line 7

def connection
  @connection
end

#nodeObject (readonly)

Returns the value of attribute node


7
8
9
# File 'lib/graphql/relay/edge.rb', line 7

def node
  @node
end

Instance Method Details

#cursorObject


13
14
15
# File 'lib/graphql/relay/edge.rb', line 13

def cursor
  @cursor ||= connection.cursor_from_node(node)
end

#parentObject


17
18
19
# File 'lib/graphql/relay/edge.rb', line 17

def parent
  @parent ||= connection.parent
end