summaryrefslogtreecommitdiff
path: root/enumerator.c
diff options
context:
space:
mode:
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)
{