Use each_slice
:
require 'enumerator' # only needed in ruby 1.8.6 and before
userids.each_slice(100) do |a|
# do something with a
end
More Related Contents:
- how to i add objects to an array ? ruby
- How do I pick randomly from an array?
- How to check if a value exists in an array in Ruby
- How to select unique elements
- Ruby array access 2 consecutive(chained) elements at a time
- How to find and return a duplicate value in array
- Array#each vs. Array#map
- What does %w(array) mean?
- How to split (chunk) a Ruby array into parts of X elements? [duplicate]
- How to find an item in array which has the most occurrences [duplicate]
- How to count duplicate elements in a Ruby array
- Find indices of elements that match a given condition
- Creating matrix with `Array.new(n, Array.new)`
- Create two-dimensional arrays and access sub-arrays in Ruby
- How do I search within an array of hashes by hash values in ruby?
- What is the best way to convert an array to a hash in Ruby
- Ruby method Array#
- Need to split arrays to sub arrays of specified size in Ruby [duplicate]
- In Ruby, why does Array.new(size, object) create an array consisting of multiple references to the same object?
- Ruby – Difference between Array#
- Sort an array according to the elements of another array
- Convert array of 2-element arrays into a hash, where duplicate keys append additional values
- How to count duplicates in Ruby Arrays
- How to sort an array in Ruby to a particular order?
- How do you add an array to another array in Ruby and not end up with a multi-dimensional result?
- How to count identical string elements in a Ruby array
- Ruby: filter array by regex?
- Ruby array subtraction without removing items more than once
- Where is it legal to use ruby splat operator?
- How do I remove blank elements from an array?