ruby-changes:22967
From: shugo <ko1@a...>
Date: Wed, 14 Mar 2012 18:26:38 +0900 (JST)
Subject: [ruby-changes:22967] shugo:r35016 (trunk): * enumerator.c: moved the comment of StopIteration.
shugo 2012-03-14 18:26:27 +0900 (Wed, 14 Mar 2012) New Revision: 35016 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=35016 Log: * enumerator.c: moved the comment of StopIteration. Modified files: trunk/ChangeLog trunk/enumerator.c Index: ChangeLog =================================================================== --- ChangeLog (revision 35015) +++ ChangeLog (revision 35016) @@ -1,3 +1,7 @@ +Wed Mar 14 18:25:18 2012 Shugo Maeda <shugo@r...> + + * enumerator.c: moved the comment of StopIteration. + Wed Mar 14 17:55:29 2012 NAKAMURA Usaku <usa@r...> * numeric.c (flodivmod): must through the same pass if HAVE_FMOD or not. Index: enumerator.c =================================================================== --- enumerator.c (revision 35015) +++ enumerator.c (revision 35016) @@ -1156,53 +1156,6 @@ return rb_proc_call(ptr->proc, args); } -/* - * Document-class: StopIteration - * - * Raised to stop the iteration, in particular by Enumerator#next. It is - * rescued by Kernel#loop. - * - * loop do - * puts "Hello" - * raise StopIteration - * puts "World" - * end - * puts "Done!" - * - * <em>produces:</em> - * - * Hello - * Done! - */ - -/* - * call-seq: - * result -> value - * - * Returns the return value of the iterator. - * - * o = Object.new - * def o.each - * yield 1 - * yield 2 - * yield 3 - * 100 - * end - * - * e = o.to_enum - * - * puts e.next #=> 1 - * puts e.next #=> 2 - * puts e.next #=> 3 - * - * begin - * e.next - * rescue StopIteration => ex - * puts ex.result #=> 100 - * end - * - */ - /* Lazy Enumerator methods */ static VALUE lazy_init_iterator(VALUE val, VALUE m, int argc, VALUE *argv) @@ -1451,6 +1404,53 @@ return obj; } +/* + * Document-class: StopIteration + * + * Raised to stop the iteration, in particular by Enumerator#next. It is + * rescued by Kernel#loop. + * + * loop do + * puts "Hello" + * raise StopIteration + * puts "World" + * end + * puts "Done!" + * + * <em>produces:</em> + * + * Hello + * Done! + */ + +/* + * call-seq: + * result -> value + * + * Returns the return value of the iterator. + * + * o = Object.new + * def o.each + * yield 1 + * yield 2 + * yield 3 + * 100 + * end + * + * e = o.to_enum + * + * puts e.next #=> 1 + * puts e.next #=> 2 + * puts e.next #=> 3 + * + * begin + * e.next + * rescue StopIteration => ex + * puts ex.result #=> 100 + * end + * + */ + static VALUE stop_result(VALUE self) { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/