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 Method Summary collapse

Constructor Details

#initialize(item, connection) ⇒ Edge

Returns a new instance of Edge.



188
189
190
191
# File 'lib/graphql/pagination/connection.rb', line 188

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

Instance Method Details

#cursorObject



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

def cursor
  @connection.cursor_for(@item)
end

#nodeObject



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

def node
  @item
end