Project

General

Profile

Bug #6908 ยป 0001-update-documentation-for-select-and-reject.patch

jeffsaracco (Jeff Saracco), 08/23/2012 09:02 AM

View differences:

array.c
* 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.
* Returns a new array containing all elements of <i>ary</i>
* for which <em>block</em> does not return <code>false</code>
* (see also <code>Enumerable#select</code>).
*
* 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.select { |v| v =~ /[aeiou]/ } #=> ["a", "e"]
enum.c
* 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 <i>enum</i>
* for which <em>block</em> does not return <code>false</code>
* (see also <code>Enumerable#reject</code>).
*
* 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]
*
*/
static VALUE
......
* 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>).
* <em>block</em> returns false (see also <code>Enumerable#find_all</code>).
*
* 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]
*
*/
static VALUE
    (1-1/1)