summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-10-06 04:35:26 +0000
committermarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-10-06 04:35:26 +0000
commitea7a3644d3e5644455589e6880178850b7b3bf65 (patch)
tree028d7cdd46b04453d05b63c37592bb51de995500
parent0fe40d4bb87f475e8100771856b8a046e7c17265 (diff)
* enum.c: [DOC] Improve doc [ci-skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56360 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--enum.c14
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 <ruby-core@marc-andre.ca>
+
+ * enum.c: [DOC] Improve doc [ci-skip]
+
Thu Oct 6 11:38:14 2016 Chris Jones <chris@christopherjones.us>
* 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 <code>false</code>.
*
* 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 <code>true</code>.
*
* 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 <code>false</code> instead of <code>true</code>.
*/
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 <code>false</code>.
*
* 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 <code>true</code> instead of <code>false</code>.
*/
static VALUE
enum_chunk_while(VALUE enumerable)