1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* enumerator.c: moved the comment of StopIteration.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35016 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
shugo 2012-03-14 09:26:27 +00:00
parent cc3d03b196
commit 449c8a2ba3
2 changed files with 51 additions and 47 deletions

View file

@ -1,3 +1,7 @@
Wed Mar 14 18:25:18 2012 Shugo Maeda <shugo@ruby-lang.org>
* enumerator.c: moved the comment of StopIteration.
Wed Mar 14 17:55:29 2012 NAKAMURA Usaku <usa@ruby-lang.org>
* numeric.c (flodivmod): must through the same pass if HAVE_FMOD or not.

View file

@ -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!"
*
* <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 @@ 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!"
*
* <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)
{