summaryrefslogtreecommitdiff
path: root/enum.c
diff options
context:
space:
mode:
authorzzak <zzak@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-09-13 18:32:07 +0000
committerzzak <zzak@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-09-13 18:32:07 +0000
commit1ae1b85e81bcfa1742e7d6fd5d02c0b11f1170ce (patch)
tree28aac69845e230320deac1d946fdc0fcf4e9b685 /enum.c
parent7a0d7e74cbdff8946c63534d0fb666af39fa72bb (diff)
* 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] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enum.c')
-rw-r--r--enum.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/enum.c b/enum.c
index a24b3d2..ac86c9d 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