Class: GraphQL::Pagination::Connection::Edge
- Inherits:
-
Object
- Object
- GraphQL::Pagination::Connection::Edge
- Defined in:
- lib/graphql/pagination/connection.rb
Overview
A wrapper around paginated items. It includes a cursor for pagination and could be extended with custom relationship-level data.
Instance Attribute Summary collapse
-
#graphql_connection_position ⇒ Object
The zero-based position of this edge in the page.
-
#node ⇒ Object
readonly
Returns the value of attribute node.
Instance Method Summary collapse
- #cursor ⇒ Object
-
#initialize(node, connection) ⇒ Edge
constructor
A new instance of Edge.
- #parent ⇒ Object
- #was_authorized_by_scope_items? ⇒ Boolean
Constructor Details
#initialize(node, connection) ⇒ Edge
Returns a new instance of Edge.
390 391 392 393 |
# File 'lib/graphql/pagination/connection.rb', line 390 def initialize(node, connection) @connection = connection @node = node end |
Instance Attribute Details
#graphql_connection_position ⇒ Object
The zero-based position of this edge in the page
388 389 390 |
# File 'lib/graphql/pagination/connection.rb', line 388 def graphql_connection_position @graphql_connection_position end |
#node ⇒ Object (readonly)
Returns the value of attribute node.
385 386 387 |
# File 'lib/graphql/pagination/connection.rb', line 385 def node @node end |
Instance Method Details
#cursor ⇒ Object
399 400 401 402 403 404 405 |
# File 'lib/graphql/pagination/connection.rb', line 399 def cursor @cursor ||= if @graphql_connection_position @connection.cursor_for_position(@node, @graphql_connection_position) else @connection.cursor_for(@node) end end |
#parent ⇒ Object
395 396 397 |
# File 'lib/graphql/pagination/connection.rb', line 395 def parent @connection.parent end |
#was_authorized_by_scope_items? ⇒ Boolean
407 408 409 |
# File 'lib/graphql/pagination/connection.rb', line 407 def @connection. end |