Issue #11007 has been updated by T Yamada.


Umm, I don't know how to pass block to each_with_index safely (without capturing).
Of course I can remove calling each_with_index, but...

# Note: I have updated email address, which I'd like for ChangeLog...

----------------------------------------
Feature #11007: Prime.each.with_index should accept offset
https://bugs.ruby-lang.org/issues/11007#change-51956

* Author: T Yamada
* Status: Open
* Priority: Normal
* Assignee: Marc-Andre Lafortune
----------------------------------------
I'd like to execute following code:

~~~
Prime.each(10).with_index(1){|e,i|
  print i,' ',e,"\n"
}
~~~

Expected output:

~~~
1 2
2 3
3 5
4 7
~~~

I have attached a patch.

---Files--------------------------------
prime.diff (1.09 KB)


-- 
https://bugs.ruby-lang.org/