summaryrefslogtreecommitdiff
path: root/enumerator.c
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-14 09:26:27 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-14 09:26:27 +0000
commit449c8a2ba3a8b11e4f875f1ae76664b7deb5112a (patch)
tree841923c58ce715594a492d64e825374f5207048b /enumerator.c
parentcc3d03b196dd3205ac8798db938711598c99d413 (diff)
* enumerator.c: moved the comment of StopIteration.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35016 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enumerator.c')
-rw-r--r--enumerator.c94
1 files changed, 47 insertions, 47 deletions
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)
{