aboutsummaryrefslogtreecommitdiffstats
path: root/enumerator.c
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-14 16:00:30 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-14 16:00:30 +0000
commit552adf8c5bc518839aa191e05875d3e0bdb251cd (patch)
tree035bdb586868f4fdca0627342d066f8d85172e3a /enumerator.c
parent0562e3ff400b7ecd7e65d03b6ae5dd95ddf16e40 (diff)
downloadruby-552adf8c5bc518839aa191e05875d3e0bdb251cd.tar.gz
* enumerator.c (enumerable_lazy): fix the documentation of
Enumerable#lazy. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35021 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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)