Skip to content

Instantly share code, notes, and snippets.

@karmajunkie
Created January 6, 2010 22:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karmajunkie/270740 to your computer and use it in GitHub Desktop.
Save karmajunkie/270740 to your computer and use it in GitHub Desktop.
Array.class_eval <<-END
def batch_process(batch_size = 20)
((self.size/batch_size)+1).times do |iter|
yield self[batch_size*iter..(batch_size*(iter+1)-1)]
end
end
END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment