Octokit::Connection::Paginator(T)
Returned for all paginated responses, such as with
Client::Repositories#repositories. Allows you
to fetch the next page, the last page, or
fetch all pages in a response.
Examples:
pages = @client.repositories
pp pages
# => #<Octokit::Connection::Paginator(Octokit::Models::Repository):0x555c3d36a000>
Constructors
Instance methods
Fetch all pages.
Example:
@client.repositories.fetch_all # => Array(Repository)
Note: This is automatically called if Configurable#auto_paginate
is set to true.
Fetch the next page.
Example:
pages = @client.repositories
pages.fetch_next # => Array(Repository)
Fetch a specific page.
Example:
pages = @client.repositories
pages.fetch_page(4) # => Array(Repository)
Fetch the previous page.
Example:
pages = @client.repositories
pages.fetch_next
pages.fetch_previous # => Array(Repository)
Note: This is really only useful if you want to fetch records backwards for some reason. Included just in case.
Checks if the current page is the last page.
Example:
pages = @client.repositories
pages.fetch_all
pages.last? # => Bool
Check if there is a next page.
Example:
pages = @client.repositories
pages.fetch_next
pages.next? # => Bool
Check if there is a previous page.
Example:
pages = @client.repositories
pages.fetch_next
pages.previous? # => Bool
Get the number of pages remaining.
Note: This is only not nil after a page has been fetched.
Get the number of total pages for this query.
Note: This is only not nil after a page has been fetched.