DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Each_slice
require 'enumerator'
(1..10).each_slice(2) { |n| p n }
# [1, 2]
# [3, 4]
# [5, 6]
# [7, 8]
# [9, 10]




