adrianomitre/cartesian — pull request #5 by bclennox (2013-01-05 03:42:15+00:00)
Title: Fixing a problem with JRuby 1.7 and yielding in CartesianIterator#each.

It seems like yielding elems directly to the block is causing a sort of loop-closure-variable-style bug where every element of the resulting array is equal to the last element yielded. When I applied this patch, all the tests passed in 1.8.7, 1.9.3, and jRuby 1.7.1. I also ran the benchmark test, and it doesn’t seem to be drastically affecting performance time.

I was able to fix the awful performance of the last benchmark in jRuby by explicitly calling "for x,y in letras_numeros.to_a; end”. That got it down to under a second. Not sure why jRuby has a problem with that. I can include a patch for that too if you want.