Class: GraphQL::Pagination::ArrayConnection
Instance Attribute Summary
Attributes inherited from Connection
#after_value, #before_value, #context, #first, #first_value, #items, #last, #last_value, #max_page_size
Instance Method Summary
collapse
Methods inherited from Connection
#after, #before, edge_class, #edge_nodes, #edges, #end_cursor, #initialize, #page_info, #start_cursor
Instance Method Details
#cursor_for(item) ⇒ Object
22
23
24
25
|
# File 'lib/graphql/pagination/array_connection.rb', line 22
def cursor_for(item)
idx = items.find_index(item) + 1
encode(idx.to_s)
end
|
#has_next_page ⇒ Object
17
18
19
20
|
# File 'lib/graphql/pagination/array_connection.rb', line 17
def has_next_page
load_nodes
@has_next_page
end
|
#has_previous_page ⇒ Object
12
13
14
15
|
# File 'lib/graphql/pagination/array_connection.rb', line 12
def has_previous_page
load_nodes
@has_previous_page
end
|
#nodes ⇒ Object
7
8
9
10
|
# File 'lib/graphql/pagination/array_connection.rb', line 7
def nodes
load_nodes
@nodes
end
|