This is a Ruby tree! It shows every object from the Ruby Programming Language in a tree format.

rindex

        # Array.rindex

(from ruby core)
---
    array.rindex(object) -> integer or nil
    array.rindex {|element| ... } -> integer or nil
    array.rindex -> new_enumerator

---

Returns the index of the last element for which `object == element`.

When argument `object` is given but no block, 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.

When a block is given but no argument, 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']
    a.rindex {|element| element == 'bar' } # => 3

Returns `nil` if the block never returns a truthy value.

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.



      

This is MURDOC! A Ruby documentation browser inspired by Smalltalk-80. It allows you to learn about Ruby by browsing through its class hierarchies, and see any of its methods.