diff options
author | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-03-14 09:26:27 +0000 |
---|---|---|
committer | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-03-14 09:26:27 +0000 |
commit | 449c8a2ba3a8b11e4f875f1ae76664b7deb5112a (patch) | |
tree | 841923c58ce715594a492d64e825374f5207048b | |
parent | cc3d03b196dd3205ac8798db938711598c99d413 (diff) | |
download | ruby-449c8a2ba3a8b11e4f875f1ae76664b7deb5112a.tar.gz |
* enumerator.c: moved the comment of StopIteration.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35016 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | enumerator.c | 94 |
2 files changed, 51 insertions, 47 deletions
@@ -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. 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!" - * - * <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) { |