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.



263
264
265
266
# File 'lib/graphql/pagination/connection.rb', line 263

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

Instance Attribute Details

#nodeObject (readonly)

Returns the value of attribute node.



261
262
263
# File 'lib/graphql/pagination/connection.rb', line 261

def node
  @node
end

Instance Method Details

#cursorObject



272
273
274
# File 'lib/graphql/pagination/connection.rb', line 272

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

#parentObject



268
269
270
# File 'lib/graphql/pagination/connection.rb', line 268

def parent
  @connection.parent
end

#was_authorized_by_scope_items?Boolean

Returns:

  • (Boolean)


276
277
278
# File 'lib/graphql/pagination/connection.rb', line 276

def was_authorized_by_scope_items?
  @connection.was_authorized_by_scope_items?
end