Skip to content
instance method

Array#rassoc

(untyped) -> ::Array[untyped]?
rassoc(object) → found_array or nil

Returns the first element ele in self such that ele is an array and ele[1] == object:

Example
a = [{foo: 0}, [2, 4], [4, 5, 6], [4, 5]]
a.rassoc(4) # => [2, 4]
a.rassoc(5) # => [4, 5, 6]

Returns nil if no such element is found.

Related: Array#assoc; see also Methods for Fetching.

See also #push #reject #product #reject! also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0