Method: Spaceship::Client#paging
- Defined in:
- spaceship/lib/spaceship/client.rb
#paging ⇒ Object
Handles the paging for you… for free Just pass a block and use the parameter as page number
321 322 323 324 325 326 327 328 329 330 331 332 333 334 |
# File 'spaceship/lib/spaceship/client.rb', line 321 def paging page = 0 results = [] loop do page += 1 current = yield(page) results += current break if (current || []).count < page_size # no more results end return results end |