From ea7a3644d3e5644455589e6880178850b7b3bf65 Mon Sep 17 00:00:00 2001 From: marcandre Date: Thu, 6 Oct 2016 04:35:26 +0000 Subject: [PATCH] * enum.c: [DOC] Improve doc [ci-skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56360 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ enum.c | 14 +++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index f4694b9d84..475c1c7930 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Thu Oct 6 13:35:15 2016 Marc-Andre Lafortune + + * enum.c: [DOC] Improve doc [ci-skip] + Thu Oct 6 11:38:14 2016 Chris Jones * ext/readline/extconf.rb: Update error message with correct words. diff --git a/enum.c b/enum.c index ff14cc87a0..62bcfba395 100644 --- a/enum.c +++ b/enum.c @@ -414,7 +414,7 @@ reject_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, ary)) * enum.reject -> an_enumerator * * Returns an array for all elements of +enum+ for which the given - * +block+ returns false. + * +block+ returns false. * * If no block is given, an Enumerator is returned instead. * @@ -3091,7 +3091,7 @@ slicebefore_i(RB_BLOCK_CALL_FUNC_ARGLIST(yielder, enumerator)) * enum.slice_before { |elt| bool }.each { |ary| ... } * * Other methods of the Enumerator class and Enumerable module, - * such as map, etc., are also usable. + * such as +to_a+, +map+, etc., are also usable. * * For example, iteration over ChangeLog entries can be implemented as * follows: @@ -3122,7 +3122,7 @@ slicebefore_i(RB_BLOCK_CALL_FUNC_ARGLIST(yielder, enumerator)) * If the block needs to maintain state over multiple elements, * local variables can be used. * For example, three or more consecutive increasing numbers can be squashed - * as follows: + * as follows (see +chunk_while+ for a better way): * * a = [0, 2, 3, 4, 6, 7, 9] * prev = a[0] @@ -3437,7 +3437,7 @@ slicewhen_i(RB_BLOCK_CALL_FUNC_ARGLIST(yielder, enumerator)) * _elt_before_ and _elt_after_, * in the receiver enumerator. * This method split chunks between _elt_before_ and _elt_after_ where - * the block returns true. + * the block returns true. * * The block is called the length of the receiver enumerator minus one. * @@ -3485,6 +3485,8 @@ slicewhen_i(RB_BLOCK_CALL_FUNC_ARGLIST(yielder, enumerator)) * p lines.slice_when {|l1, l2| /\A\s*\z/ =~ l1 && /\S/ =~ l2 }.to_a * #=> [["foo\n", "bar\n", "\n"], ["baz\n", "qux\n"]] * + * Enumerable#chunk_while does the same, except splitting when the block + * returns false instead of true. */ static VALUE enum_slice_when(VALUE enumerable) @@ -3514,7 +3516,7 @@ enum_slice_when(VALUE enumerable) * _elt_before_ and _elt_after_, * in the receiver enumerator. * This method split chunks between _elt_before_ and _elt_after_ where - * the block returns false. + * the block returns false. * * The block is called the length of the receiver enumerator minus one. * @@ -3549,6 +3551,8 @@ enum_slice_when(VALUE enumerable) * p a.chunk_while {|i, j| i.even? == j.even? }.to_a * #=> [[7, 5, 9], [2, 0], [7, 9], [4, 2, 0]] * + * Enumerable#slice_when does the same, except splitting when the block + * returns true instead of false. */ static VALUE enum_chunk_while(VALUE enumerable)