Skip to content

Instantly share code, notes, and snippets.

@carllerche
Created November 13, 2009 19:52
Show Gist options
  • Save carllerche/234103 to your computer and use it in GitHub Desktop.
Save carllerche/234103 to your computer and use it in GitHub Desktop.
class Array
def /(n)
arr = []
size = length / n
size += 1 if length % n > 0
n.times do |i|
arr << self[i*size, size]
end
arr
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment