aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--array.c11
-rw-r--r--enum.c19
3 files changed, 27 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index bb30d28cbc..0af11e55c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Fri Sep 14 03:30:00 2012 Zachary Scott <zzak@ruby-lang.org>
+
+ * array.c (rb_ary_select):
+ Update documentation for Array#select
+ * enum.c (enum_find_all, enum_reject):
+ Update documentation for Enumerable#find_all and Enumerable#reject
+ Based on a patch by Jeff Saracco
+ [Bug #6908] [ruby-core:47285] [Fixes #166 on github]
+
Fri Sep 14 00:20:00 2012 Zachary Scott <zzak@ruby-lang.org>
* signal.c (rb_f_kill):
diff --git a/array.c b/array.c
index 524553a119..273768fbd1 100644
--- a/array.c
+++ b/array.c
@@ -2408,16 +2408,17 @@ rb_ary_values_at(int argc, VALUE *argv, VALUE ary)
* ary.select { |item| block } -> new_ary
* ary.select -> Enumerator
*
- * Invokes the given block passing in successive elements from +self+,
- * returning an array containing those elements for which the block returns
- * a +true+ value.
- *
- * See also Enumerable#select.
+ * Returns a new array containing all elements of +ary+
+ * for which the given +block+ returns a true value.
*
* If no block is given, an Enumerator is returned instead.
*
+ * [1,2,3,4,5].select { |num| num.even? } #=> [2, 4]
+ *
* a = %w{ a b c d e f }
* a.select { |v| v =~ /[aeiou]/ } #=> ["a", "e"]
+ *
+ * See also Enumerable#select.
*/
static VALUE
diff --git a/enum.c b/enum.c
index a24b3d2692..ac86c9d550 100644
--- a/enum.c
+++ b/enum.c
@@ -311,15 +311,17 @@ find_all_i(VALUE i, VALUE ary, int argc, VALUE *argv)
* enum.find_all -> an_enumerator
* enum.select -> an_enumerator
*
- * Returns an array containing all elements of <i>enum</i> for which
- * <em>block</em> is not <code>false</code> (see also
- * <code>Enumerable#reject</code>).
+ * Returns an array containing all elements of +enum+
+ * for which the given +block+ returns a true value.
*
- * If no block is given, an enumerator is returned instead.
+ * If no block is given, an Enumerator is returned instead.
*
*
* (1..10).find_all { |i| i % 3 == 0 } #=> [3, 6, 9]
*
+ * [1,2,3,4,5].select { |num| num.even? } #=> [2, 4]
+ *
+ * See also Enumerable#reject.
*/
static VALUE
@@ -351,13 +353,16 @@ reject_i(VALUE i, VALUE ary, int argc, VALUE *argv)
* enum.reject { |obj| block } -> array
* enum.reject -> an_enumerator
*
- * Returns an array for all elements of <i>enum</i> for which
- * <em>block</em> is false (see also <code>Enumerable#find_all</code>).
+ * Returns an array for all elements of +enum+ for which the given
+ * +block+ returns false.
*
- * If no block is given, an enumerator is returned instead.
+ * If no block is given, an Enumerator is returned instead.
*
* (1..10).reject { |i| i % 3 == 0 } #=> [1, 2, 4, 5, 7, 8, 10]
*
+ * [1, 2, 3, 4, 5].reject { |num| num.even? } #=> [1, 3, 5]
+ *
+ * See also Enumerable#find_all.
*/
static VALUE