Created
February 2, 2011 22:04
-
-
Save seejohnrun/808552 to your computer and use it in GitHub Desktop.
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
# split into groups of maximum size BATCH_SIZE | |
groups = []; grp = nil | |
items.each_with_index do |item, idx| | |
groups << (grp = []) if idx % BATCH_SIZE == 0 | |
grp << item | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment