Class: GraphQL::Pagination::Connection::Edge

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(node, connection) ⇒ Edge

Returns a new instance of Edge.



195
196
197
198
# File 'lib/graphql/pagination/connection.rb', line 195

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

Instance Attribute Details

#nodeObject (readonly)

Returns the value of attribute node.



193
194
195
# File 'lib/graphql/pagination/connection.rb', line 193

def node
  @node
end

Instance Method Details

#cursorObject



204
205
206
# File 'lib/graphql/pagination/connection.rb', line 204

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

#parentObject



200
201
202
# File 'lib/graphql/pagination/connection.rb', line 200

def parent
  @connection.parent
end