File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed
Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -141,11 +141,10 @@ The loop will finish when there is no `rels[:next]` information to consume (in o
141141words, we are at ` rels[:last] ` ). It might look something like this:
142142
143143 #!ruby
144- loop do
145- puts last_response.data.items.first.path
144+ puts last_response.data.items.first.path
145+ until last_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
151150Changing 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- puts last_response.data.items.first.path
172+ puts last_response.data.items.first.path
173+ until last_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
You can’t perform that action at this time.
0 commit comments