summaryrefslogtreecommitdiff
path: root/enum.c
diff options
context:
space:
mode:
authorBurdette Lamar <[email protected]>2021-10-06 19:06:17 -0500
committer<[email protected]>2021-10-06 19:06:17 -0500
commit7caeead36fc6589f07d91e9c45e69181d3b30640 ()
tree6ab4361f0737187c8a8dfcff3d53713cd2c40f5f /enum.c
parentfb122042e004c799d4ed7080785c86a57db0ee9c (diff)
Accommondate earlier reviews of RDoc for Enumerable (#4943)
Notes: Merged-By: BurdetteLamar <[email protected]>
-rw-r--r--enum.c44
1 files changed, 36 insertions, 8 deletions
@@ -1940,7 +1940,7 @@ rb_nmin_run(VALUE obj, VALUE num, int by, int rev, int ary)
* (1..4).one? {|element| element < 2 } # => true
* (1..4).one? {|element| element < 1 } # => false
* {foo: 0, bar: 1, baz: 2}.one? {|key, value| value < 1 } # => true
- * {foo: 0, bar: 1, baz: 2}.one? {|key, value| value < 2 } # => false
*
* Related: #none?, #all?, #any?.
*
@@ -2002,9 +2002,9 @@ DEFINE_ENUMFUNCS(none)
* (1..4).none? {|element| element < 1 } # => true
* (1..4).none? {|element| element < 2 } # => false
* {foo: 0, bar: 1, baz: 2}.none? {|key, value| value < 0 } # => true
- * {foo: 0, bar: 1, baz: 2}.none? {|key, value| value < 1 } # => false
*
- * Related: #.one?, #all?, #any.
*
*/
static VALUE
@@ -2100,6 +2100,8 @@ min_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
* returns the minimum element as determined by the block:
*
* %w[xxx x xxxx xx].min {|a, b| a.size <=> b.size } # => "x"
* [].min {|a, b| a <=> b } # => nil
*
* With a block given and positive integer argument +n+ given,
@@ -2107,6 +2109,9 @@ min_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
* as determined by the block.
*
* %w[xxx x xxxx xx].min(2) {|a, b| a.size <=> b.size } # => ["x", "xx"]
* [].min(2) {|a, b| a <=> b } # => []
*
* Related: #min_by, #minmax, #max.
@@ -2220,6 +2225,8 @@ max_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
* returns the maximum element as determined by the block:
*
* %w[xxx x xxxx xx].max {|a, b| a.size <=> b.size } # => "xxxx"
* [].max {|a, b| a <=> b } # => nil
*
* With a block given and positive integer argument +n+ given,
@@ -2227,6 +2234,9 @@ max_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
* as determined by the block.
*
* %w[xxx x xxxx xx].max(2) {|a, b| a.size <=> b.size } # => ["xxxx", "xxx"]
* [].max(2) {|a, b| a <=> b } # => []
*
* Related: #min, #minmax, #max_by.
@@ -2391,6 +2401,9 @@ minmax_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, _memo))
* as determined by the block:
*
* %w[xxx x xxxx xx].minmax {|a, b| a.size <=> b.size } # => ["x", "xxxx"]
* [].minmax {|a, b| a <=> b } # => [nil, nil]
*
* Related: #min, #max, #minmax_by.
@@ -2856,6 +2869,22 @@ each_val_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, p))
* # => {:foo=>0, :bar=>1, :baz=>2}
* a # => [[:foo, 0], [:bar, 1], [:baz, 2]]
*
* With no block given, returns an Enumerator.
*
*/
@@ -3062,7 +3091,6 @@ each_with_object_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memo))
* and the given object:
*
* (1..4).each_with_object([]) {|i, a| a.push(i**2) } # => [1, 4, 9, 16]
- * # => {}
* h.each_with_object({}) {|element, h| k, v = *element; h[v] = k }
* # => {0=>:foo, 1=>:bar, 2=>:baz}
*
@@ -3293,7 +3321,7 @@ take_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
* r.take(2) # => [1, 2]
* r.take(0) # => []
*
- * h = {foo:0, bar: 1, baz: 2, bat: 3}
* h.take(2) # => [[:foo, 0], [:bar, 1]]
*
*/
@@ -3337,8 +3365,8 @@ take_while_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, ary))
*
* (1..4).take_while{|i| i < 3 } # => [1, 2]
* h = {foo: 0, bar: 1, baz: 2}
- * a = h.take_while{|element| key, value = *element; value < 2 }
- * a # => [[:foo, 0], [:bar, 1]]
*
* With no block given, returns an Enumerator.
*
@@ -3382,7 +3410,7 @@ drop_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
* r.drop(0) # => [1, 2, 3, 4]
* r.drop(50) # => []
*
- * h = {foo:0, bar: 1, baz: 2, bat: 3}
* h.drop(2) # => [[:baz, 2], [:bat, 3]]
*
*/