Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8b8b8ce

Browse files
author
Hubot
committed
Sync changes from upstream repository
1 parent70d2b79 commit8b8b8ce

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

‎content/guides/traversing-with-pagination.md‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,10 @@ The loop will finish when there is no `rels[:next]` information to consume (in o
141141
words, we are at`rels[:last]`). It might look something like this:
142142

143143
#!ruby
144-
loop do
145-
putslast_response.data.items.first.path
144+
puts last_response.data.items.first.path
145+
untillast_response.rels[:next].nil?
146146
last_response = last_response.rels[:next].get
147-
sleep 4 # back off from the API rate limiting; don't do this in Real Life
148-
break if last_response.rels[:next].nil?
147+
puts last_response.data.items.first.path
149148
end
150149

151150
Changing the number of items per page is extremely simple with Octokit.rb. Simply
@@ -170,11 +169,10 @@ your code should remain intact:
170169

171170
puts "And here's the first path for every set"
172171

173-
loop do
174-
putslast_response.data.items.first.path
172+
puts last_response.data.items.first.path
173+
untillast_response.rels[:next].nil?
175174
last_response = last_response.rels[:next].get
176-
sleep 4 # back off from the API rate limiting; don't do this in Real Life
177-
break if last_response.rels[:next].nil?
175+
puts last_response.data.items.first.path
178176
end
179177

180178
##Constructing Pagination Links

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp