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.



156
157
158
159
# File 'lib/graphql/pagination/connection.rb', line 156

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

Instance Method Details

#cursorObject



165
166
167
# File 'lib/graphql/pagination/connection.rb', line 165

def cursor
  @connection.cursor_for(@item)
end

#nodeObject



161
162
163
# File 'lib/graphql/pagination/connection.rb', line 161

def node
  @item
end