From 552adf8c5bc518839aa191e05875d3e0bdb251cd Mon Sep 17 00:00:00 2001 From: shugo Date: Wed, 14 Mar 2012 16:00:30 +0000 Subject: * 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 --- enumerator.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'enumerator.c') 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) -- cgit v1.2.3