[前][次][番号順一覧][スレッド一覧]

ruby-changes:44287

From: marcandre <ko1@a...>
Date: Thu, 6 Oct 2016 13:35:32 +0900 (JST)
Subject: [ruby-changes:44287] marcandRe: r56360 (trunk): * enum.c: [DOC] Improve doc [ci-skip]

marcandre	2016-10-06 13:35:26 +0900 (Thu, 06 Oct 2016)

  New Revision: 56360

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56360

  Log:
    * enum.c: [DOC] Improve doc [ci-skip]

  Modified files:
    trunk/ChangeLog
    trunk/enum.c
Index: enum.c
===================================================================
--- enum.c	(revision 56359)
+++ enum.c	(revision 56360)
@@ -414,7 +414,7 @@ reject_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, a https://github.com/ruby/ruby/blob/trunk/enum.c#L414
  *     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 https://github.com/ruby/ruby/blob/trunk/enum.c#L3091
  *    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 https://github.com/ruby/ruby/blob/trunk/enum.c#L3122
  *  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(y https://github.com/ruby/ruby/blob/trunk/enum.c#L3437
  *  _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(y https://github.com/ruby/ruby/blob/trunk/enum.c#L3485
  *    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) https://github.com/ruby/ruby/blob/trunk/enum.c#L3516
  *  _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) https://github.com/ruby/ruby/blob/trunk/enum.c#L3551
  *    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)
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 56359)
+++ ChangeLog	(revision 56360)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Oct  6 13:35:15 2016  Marc-Andre Lafortune  <ruby-core@m...>
+
+	* enum.c: [DOC] Improve doc [ci-skip]
+
 Thu Oct  6 11:38:14 2016  Chris Jones  <chris@c...>
 
 	* ext/readline/extconf.rb: Update error message with correct words.

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]