Issue #7493 has been updated by knu (Akinori MUSHA).


1.8??с???next??? lib/generator.rb ??у??茖?????????????障?????

????????????????????わ?????罨蚊???????<?純????????Enumerator???next??у???????????????????ゃ?障??綽?荀?????????????羝<?????????????????с??????????????篏帥????鴻??1.8??с??喝???????????障???????с????????
??ゃ?障?????篋?????????????????????????????????絎???с????????????????????障?????

?????????腥冴???????????{}鐚?????箴≦?ゃ??nil?????????????????????????1.9篁ラ????????????nil???菴??????????????????吟???????????с????????????
Enumerable#to_a ????????????с??nil???菴??????????????х弘???菴??????????障?????

??眼????????????????????с????????1.8.7??????????篆罩c????ャ???????????????????с????????????
羂??????????????с???????違?????若???у???????????≪?潟??若??????????????帥??????????????
筝?綽? ruby_1_8 ????ャ???????????障?????

Index: lib/generator.rb
===================================================================
--- lib/generator.rb	(revision 38134)
+++ lib/generator.rb	(working copy)
@@ -69,7 +69,7 @@ class Generator
   def initialize(enum = nil, &block)
     if enum
       @block = proc { |g|
-	enum.each { |x| g.yield x }
+	enum.each { |x| g.yield x; nil }
       }
     else
       @block = block

----------------------------------------
Bug #7493: ???????????羝<??????????翫???????????1荀?膣????帥??菴????Enumerator??絲??????next?????????膓???????????2綺???StopIteration箴?紊??????榊????????
https://bugs.ruby-lang.org/issues/7493#change-34315

Author: kachick (Kenichi Kamiya)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: Ruby 1.8.7
ruby -v: ruby 1.8.7 (2012-10-12 patchlevel 371) [x86_64-linux]


???????????????????у?????????????翫?????????????????ゃ????c??1荀?膣????帥??菴??????<?純??????????????Enumerator???篏????????
2綺???next???StopIteration箴?紊????菴????????????с?????
????????潟?c??????????х∈茯?????????<?純?????????篁ヤ??????с?????

* Array#index
* Array#find_index
* Array#rindex
* Enumerable#detect
* Enumerable#find

??????????1.8.7???1.9???????罕????若?????綏?違???????????鴻?????????с???????????鐚?
???????????????Enumerator??絲??????to_a??????????????膣????????Array???菴????篋??????????
1.8.7???若??????????膣?莎井?糸?堺?ャ????鴻?????吟?с??<??????????????障????????

# to_a???綏??違???dbussink?????????ф????ャ??????????堺?ャ?障????????
# https://github.com/rubinius/rubinius/pull/2063#issuecomment-10881875

  array = [:a, :b, :c]
  index_enum = array.index
  index_enum.to_a #=> [:a, :b, :c]
  index_enum.next #=> :a
  index_enum.next #=> StopIteration: iteration reached at end


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