1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
zzak 2012-09-13 18:32:07 +00:00
parent 7a0d7e74cb
commit 1ae1b85e81
3 changed files with 27 additions and 12 deletions

View file

@ -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> Fri Sep 14 00:20:00 2012 Zachary Scott <zzak@ruby-lang.org>
* signal.c (rb_f_kill): * signal.c (rb_f_kill):

11
array.c
View file

@ -2408,16 +2408,17 @@ rb_ary_values_at(int argc, VALUE *argv, VALUE ary)
* ary.select { |item| block } -> new_ary * ary.select { |item| block } -> new_ary
* ary.select -> Enumerator * ary.select -> Enumerator
* *
* Invokes the given block passing in successive elements from +self+, * Returns a new array containing all elements of +ary+
* returning an array containing those elements for which the block returns * for which the given +block+ returns a true value.
* a +true+ value.
*
* See also Enumerable#select.
* *
* If no block is given, an Enumerator is returned instead. * 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 = %w{ a b c d e f }
* a.select { |v| v =~ /[aeiou]/ } #=> ["a", "e"] * a.select { |v| v =~ /[aeiou]/ } #=> ["a", "e"]
*
* See also Enumerable#select.
*/ */
static VALUE static VALUE

19
enum.c
View file

@ -311,15 +311,17 @@ find_all_i(VALUE i, VALUE ary, int argc, VALUE *argv)
* enum.find_all -> an_enumerator * enum.find_all -> an_enumerator
* enum.select -> an_enumerator * enum.select -> an_enumerator
* *
* Returns an array containing all elements of <i>enum</i> for which * Returns an array containing all elements of +enum+
* <em>block</em> is not <code>false</code> (see also * for which the given +block+ returns a true value.
* <code>Enumerable#reject</code>).
* *
* 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..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 static VALUE
@ -351,13 +353,16 @@ reject_i(VALUE i, VALUE ary, int argc, VALUE *argv)
* enum.reject { |obj| block } -> array * enum.reject { |obj| block } -> array
* enum.reject -> an_enumerator * enum.reject -> an_enumerator
* *
* Returns an array for all elements of <i>enum</i> for which * Returns an array for all elements of +enum+ for which the given
* <em>block</em> is false (see also <code>Enumerable#find_all</code>). * +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..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 static VALUE