From 449c8a2ba3a8b11e4f875f1ae76664b7deb5112a Mon Sep 17 00:00:00 2001 From: shugo Date: Wed, 14 Mar 2012 09:26:27 +0000 Subject: * enumerator.c: moved the comment of StopIteration. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35016 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- enumerator.c | 94 ++++++++++++++++++++++++++++++------------------------------ 1 file changed, 47 insertions(+), 47 deletions(-) (limited to 'enumerator.c') diff --git a/enumerator.c b/enumerator.c index f4ccda0121..ad301a9c1e 100644 --- a/enumerator.c +++ b/enumerator.c @@ -1156,53 +1156,6 @@ generator_each(int argc, VALUE *argv, VALUE obj) 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!" - * - * produces: - * - * 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 @@ lazy_lazy(VALUE obj) 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!" + * + * produces: + * + * 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) { -- cgit v1.2.3