Skip to content

Instantly share code, notes, and snippets.

@sw17ch
Created October 31, 2011 18:00
Show Gist options
  • Save sw17ch/1328199 to your computer and use it in GitHub Desktop.
Save sw17ch/1328199 to your computer and use it in GitHub Desktop.
Some times I love monkey patching.
class Array
def subdivide(len)
return self if len <= 0 || len >= self.size
from = 0
result = []
while from < self.size
result << self.slice(from, len)
from += len
end
result
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment