aboutsummaryrefslogtreecommitdiffstats
path: root/enumerator.c
diff options
context:
space:
mode:
Diffstat (limited to 'enumerator.c')
-rw-r--r--enumerator.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/enumerator.c b/enumerator.c
index ab0c39e6c1..c4d18ac076 100644
--- a/enumerator.c
+++ b/enumerator.c
@@ -1209,12 +1209,13 @@ lazy_initialize(VALUE self, VALUE obj)
* e.lazy -> lazy_enumerator
*
* Returns a lazy enumerator, whose methods map/collect,
- * flat_map/collect_concat, select/find_all, reject, and grep call blocks
- * only on an as-needed basis.
+ * flat_map/collect_concat, select/find_all, reject, grep, zip, take,
+ * take_while, drop, and drop_while enumerate values only on an as-needed
+ * basis.
*
* === Example
*
- * The following program shows all pythagorean triples less than 100:
+ * The following program finds pythagorean triples:
*
* def pythagorean_triples
* (1..Float::INFINITY).lazy.flat_map {|z|
@@ -1227,7 +1228,10 @@ lazy_initialize(VALUE self, VALUE obj)
* }
* }
* end
- * p pythagorean_triples.take_while { |x, y, z| z < 100 }
+ * # show first ten pythagorean triples
+ * p pythagorean_triples.take(10).force
+ * # show pythagorean triples less than 100
+ * p pythagorean_triples.take_while { |*, z| z < 100 }.force
*/
static VALUE
enumerable_lazy(VALUE obj)