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.



168
169
170
171
# File 'lib/graphql/pagination/connection.rb', line 168

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

Instance Method Details

#cursorObject



177
178
179
# File 'lib/graphql/pagination/connection.rb', line 177

def cursor
  @connection.cursor_for(@item)
end

#nodeObject



173
174
175
# File 'lib/graphql/pagination/connection.rb', line 173

def node
  @item
end