I've read the documentation of the methods assoc
and rassoc
of Ruby array
. I understand what they do. They both work on arrays of arrays. assoc
returns the array whose first element equals the provided parameter, and rassoc
does the same, but for the second element.
My question is what are these methods for? This functionality is very specific. I'm guessing there is some reason why these methods were created. what is it?