Skip to content

Instantly share code, notes, and snippets.

@owainlewis owainlewis/chunks.rb
Created Apr 28, 2012

What would you like to do?
Grouping sequence by n in Ruby
def group_sequence_by n, sequence do |result|
sequence.each_slice(n) { |item| result << item }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.