repo.or.cz
/
ruby.git
/
commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
raw
|
patch
|
inline
|
side by side
(parent:
1962be2
)
[DOC] Tweaks for Array#rindex
author
BurdetteLamar
<
[email protected]
>
Wed, 9 Oct 2024 17:33:19 +0000
(9 12:33 -0500)
committer
Peter Zhu
<
[email protected]
>
Wed, 9 Oct 2024 18:05:24 +0000
(9 14:05 -0400)
array.c
patch
|
blob
|
blame
|
history
diff --git
a/array.c
b/array.c
index
a4c600a
..
d4788ff
100644
(file)
--- a/
array.c
+++ b/
array.c
@@
-2129,20
+2129,20
@@
rb_ary_index(int argc, VALUE *argv, VALUE ary)
/*
* call-seq:
/*
* call-seq:
- *
array.
rindex(object) -> integer or nil
- *
array.
rindex {|element| ... } -> integer or nil
- *
array.
rindex -> new_enumerator
+ * rindex(object) -> integer or nil
+ * rindex {|element| ... } -> integer or nil
+ * rindex -> new_enumerator
*
* Returns the index of the last element for which <tt>object == element</tt>.
*
*
* Returns the index of the last element for which <tt>object == element</tt>.
*
- * W
hen argument +object+ is given but no block
, returns the index of the last such element found:
+ * W
ith argument +object+ given
, returns the index of the last such element found:
*
* a = [:foo, 'bar', 2, 'bar']
* a.rindex('bar') # => 3
*
* Returns +nil+ if no such object found.
*
*
* a = [:foo, 'bar', 2, 'bar']
* a.rindex('bar') # => 3
*
* Returns +nil+ if no such object found.
*
- * W
hen a block is given but no argument
, calls the block with each successive element;
+ * W
ith a block given
, calls the block with each successive element;
* returns the index of the last element for which the block returns a truthy value:
*
* a = [:foo, 'bar', 2, 'bar']
* returns the index of the last element for which the block returns a truthy value:
*
* a = [:foo, 'bar', 2, 'bar']
@@
-2150,14
+2150,9
@@
rb_ary_index(int argc, VALUE *argv, VALUE ary)
*
* Returns +nil+ if the block never returns a truthy value.
*
*
* Returns +nil+ if the block never returns a truthy value.
*
- * When neither an argument nor a block is given, returns a new Enumerator
:
+ * When neither an argument nor a block is given, returns a new Enumerator
.
*
*
- * a = [:foo, 'bar', 2, 'bar']
- * e = a.rindex
- * e # => #<Enumerator: [:foo, "bar", 2, "bar"]:rindex>
- * e.each {|element| element == 'bar' } # => 3
- *
- * Related: #index.
+ * Related: see {Methods for Querying}[rdoc-ref:Array@Methods+for+Querying].
*/
static VALUE
*/
static VALUE