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

ruby-changes:21367

From: drbrain <ko1@a...>
Date: Thu, 6 Oct 2011 09:57:17 +0900 (JST)
Subject: [ruby-changes:21367] drbrain:r33416 (trunk): * enum.c: Clean up wording in Enumerable documentation. Patch by b t.

drbrain	2011-10-06 09:57:06 +0900 (Thu, 06 Oct 2011)

  New Revision: 33416

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=33416

  Log:
    * enum.c:  Clean up wording in Enumerable documentation.  Patch by b t.
      [Ruby 1.9 - Bug #5411

  Modified files:
    trunk/ChangeLog
    trunk/enum.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 33415)
+++ ChangeLog	(revision 33416)
@@ -1,3 +1,8 @@
+Thu Oct  6 09:56:30 2011  Eric Hodel  <drbrain@s...>
+
+	* enum.c:  Clean up wording in Enumerable documentation.  Patch by b t.
+	  [Ruby 1.9 - Bug #5411
+
 Thu Oct  6 09:17:18 2011  Eric Hodel  <drbrain@s...>
 
 	* time.c (Init_Time):  Remove editorial comments from Time
Index: enum.c
===================================================================
--- enum.c	(revision 33415)
+++ enum.c	(revision 33416)
@@ -129,11 +129,11 @@
  *     enum.count(item)             -> int
  *     enum.count {| obj | block }  -> int
  *
- *  Returns the number of items in <i>enum</i>, where #size is called
- *  if it responds to it, otherwise the items are counted through
- *  enumeration.  If an argument is given, counts the number of items
- *  in <i>enum</i>, for which equals to <i>item</i>.  If a block is
- *  given, counts the number of elements yielding a true value.
+ *  Returns the number of items in <i>enum</i> if it responds to a #size call,
+ *  otherwise the items are counted through enumeration.  If an argument is
+ *  given the number of items in <i>enum</i> that are equal to <i>item</i> are
+ *  counted.  If a block is given, it counts the number of elements yielding a
+ *  true value.
  *
  *     ary = [1, 2, 4, 2]
  *     ary.count             #=> 4
@@ -539,10 +539,9 @@
  *  return value for the method.
  *
  *  If you do not explicitly specify an <i>initial</i> value for <i>memo</i>,
- *  then uses the first element of collection is used as the initial value
+ *  then the first element of collection is used as the initial value
  *  of <i>memo</i>.
  *
- *  Examples:
  *
  *     # Sum some numbers
  *     (5..10).reduce(:+)                            #=> 45
@@ -837,7 +836,7 @@
  *  The current implementation of <code>sort_by</code> generates an
  *  array of tuples containing the original collection element and the
  *  mapped value. This makes <code>sort_by</code> fairly expensive when
- *  the keysets are simple
+ *  the keysets are simple.
  *
  *     require 'benchmark'
  *
@@ -970,9 +969,9 @@
  *  Passes each element of the collection to the given block. The method
  *  returns <code>true</code> if the block never returns
  *  <code>false</code> or <code>nil</code>. If the block is not given,
- *  Ruby adds an implicit block of <code>{|obj| obj}</code> (that is
- *  <code>all?</code> will return <code>true</code> only if none of the
- *  collection members are <code>false</code> or <code>nil</code>.)
+ *  Ruby adds an implicit block of <code>{ |obj| obj }</code> which will
+ *  cause #all? to return +true+ when none of the collection members are
+ *  +false+ or +nil+.
  *
  *     %w{ant bear cat}.all? {|word| word.length >= 3}   #=> true
  *     %w{ant bear cat}.all? {|word| word.length >= 4}   #=> false
@@ -1005,10 +1004,9 @@
  *  Passes each element of the collection to the given block. The method
  *  returns <code>true</code> if the block ever returns a value other
  *  than <code>false</code> or <code>nil</code>. If the block is not
- *  given, Ruby adds an implicit block of <code>{|obj| obj}</code> (that
- *  is <code>any?</code> will return <code>true</code> if at least one
- *  of the collection members is not <code>false</code> or
- *  <code>nil</code>.
+ *  given, Ruby adds an implicit block of <code>{ |obj| obj }</code> that
+ *  will cause #any? to return +true+ if at least one of the collection
+ *  members is not +false+ or +nil+.
  *
  *     %w{ant bear cat}.any? {|word| word.length >= 3}   #=> true
  *     %w{ant bear cat}.any? {|word| word.length >= 4}   #=> true
@@ -1552,8 +1550,8 @@
  *     enum.minmax_by {|obj| block }   -> [min, max]
  *     enum.minmax_by                  -> an_enumerator
  *
- *  Returns two elements array array containing the objects in
- *  <i>enum</i> that gives the minimum and maximum values respectively
+ *  Returns a two element array containing the objects in
+ *  <i>enum</i> that correspond to the minimum and maximum values respectively
  *  from the given block.
  *
  *  If no block is given, an enumerator is returned instead.
@@ -1762,7 +1760,6 @@
  *  Iterates the given block for each slice of <n> elements.  If no
  *  block is given, returns an enumerator.
  *
- *  e.g.:
  *      (1..10).each_slice(3) {|a| p a}
  *      # outputs below
  *      [1, 2, 3]
@@ -1862,7 +1859,6 @@
  *
  *  If no block is given, returns an enumerator.
  *
- *  e.g.:
  *      evens = (1..10).each_with_object([]) {|i, a| a << i*2 }
  *      #=> [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]
  *

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

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