diff --git a/ChangeLog b/ChangeLog index 78787cc8bb..5b6e2d0f82 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Oct 6 09:56:30 2011 Eric Hodel + + * 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 * time.c (Init_Time): Remove editorial comments from Time diff --git a/enum.c b/enum.c index 77ecd2fa56..3120b066da 100644 --- a/enum.c +++ b/enum.c @@ -129,11 +129,11 @@ count_all_i(VALUE i, VALUE memop, int argc, VALUE *argv) * enum.count(item) -> int * enum.count {| obj | block } -> int * - * Returns the number of items in enum, 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 enum, for which equals to item. If a block is - * given, counts the number of elements yielding a true value. + * Returns the number of items in enum if it responds to a #size call, + * otherwise the items are counted through enumeration. If an argument is + * given the number of items in enum that are equal to item 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 @@ inject_op_i(VALUE i, VALUE p, int argc, VALUE *argv) * return value for the method. * * If you do not explicitly specify an initial value for memo, - * 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 memo. * - * Examples: * * # Sum some numbers * (5..10).reduce(:+) #=> 45 @@ -837,7 +836,7 @@ sort_by_cmp(const void *ap, const void *bp, void *data) * The current implementation of sort_by generates an * array of tuples containing the original collection element and the * mapped value. This makes sort_by fairly expensive when - * the keysets are simple + * the keysets are simple. * * require 'benchmark' * @@ -970,9 +969,9 @@ DEFINE_ENUMFUNCS(all) * Passes each element of the collection to the given block. The method * returns true if the block never returns * false or nil. If the block is not given, - * Ruby adds an implicit block of {|obj| obj} (that is - * all? will return true only if none of the - * collection members are false or nil.) + * Ruby adds an implicit block of { |obj| obj } 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 @@ DEFINE_ENUMFUNCS(any) * Passes each element of the collection to the given block. The method * returns true if the block ever returns a value other * than false or nil. If the block is not - * given, Ruby adds an implicit block of {|obj| obj} (that - * is any? will return true if at least one - * of the collection members is not false or - * nil. + * given, Ruby adds an implicit block of { |obj| obj } 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 @@ minmax_by_i(VALUE i, VALUE _memo, int argc, VALUE *argv) * enum.minmax_by {|obj| block } -> [min, max] * enum.minmax_by -> an_enumerator * - * Returns two elements array array containing the objects in - * enum that gives the minimum and maximum values respectively + * Returns a two element array containing the objects in + * enum 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 @@ each_slice_i(VALUE i, VALUE *memo, int argc, VALUE *argv) * Iterates the given block for each slice of 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 @@ each_with_object_i(VALUE i, VALUE memo, int argc, VALUE *argv) * * 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] *