@justinstoller found it! Block variables didn't shadow variables in the enclosing scope until Ruby 1.9. In 1.8 the inner `i` would clobber the outer one.