This repository has been archived by the owner on Jan 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add @cache to Moped::Cursor for out-of-block iteration
The Mongo Ruby driver (and thus Mongoid 2.x) supported iterating over a cursor outside a block, using such operations as take(). For example: batch_size = 10 cursor = session[:users].find({}).cursor while (users = cursor.take(batch_size)).present? # Do stuff... end # Do more stuff... This was a convenient pattern for implementing lots of algorithms in a more readable way than if they were written using each().
- Loading branch information
Frank Macreery
committed
Nov 27, 2013
1 parent
073e30b
commit 2d854a0
Showing
2 changed files
with
25 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters