Class: GraphQL::Relay::Edge
- Inherits:
-
ObjectType
- Object
- BaseType
- ObjectType
- GraphQL::Relay::Edge
- 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
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#node ⇒ Object
readonly
Returns the value of attribute node.
Attributes inherited from ObjectType
Attributes inherited from BaseType
#default_relay, #default_scalar, #description, #introspection, #name
Instance Method Summary collapse
- #cursor ⇒ Object
-
#initialize(node, connection) ⇒ Edge
constructor
A new instance of Edge.
- #parent ⇒ Object
Methods inherited from ObjectType
#all_fields, #get_field, #implements, #initialize_copy, #interfaces, #interfaces=, #kind
Methods inherited from BaseType
#==, #coerce_input, #coerce_isolated_input, #coerce_isolated_result, #coerce_result, #connection_type, #default_relay?, #default_scalar?, #define_connection, #define_edge, #edge_type, #get_field, #initialize_copy, #introspection?, resolve_related_type, #resolve_type, #to_definition, #to_list_type, #to_non_null_type, #to_s, #unwrap, #valid_input?, #valid_isolated_input?, #validate_input, #validate_isolated_input
Methods included from Define::InstanceDefinable
#define, #initialize_copy, #metadata, #redefine
Methods included from Define::NonNullWithBang
Constructor Details
#initialize(node, connection) ⇒ Edge
Returns a new instance of Edge.
9 10 11 12 |
# File 'lib/graphql/relay/edge.rb', line 9 def initialize(node, connection) @node = node @connection = connection end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
8 9 10 |
# File 'lib/graphql/relay/edge.rb', line 8 def connection @connection end |
#node ⇒ Object (readonly)
Returns the value of attribute node.
8 9 10 |
# File 'lib/graphql/relay/edge.rb', line 8 def node @node end |
Instance Method Details
#cursor ⇒ Object
14 15 16 |
# File 'lib/graphql/relay/edge.rb', line 14 def cursor @cursor ||= connection.cursor_from_node(node) end |
#parent ⇒ Object
18 19 20 |
# File 'lib/graphql/relay/edge.rb', line 18 def parent @parent ||= connection.parent end |