Instance method
# rassoc
Returns a new 2-element Array consisting of the key and value of the first-found entry whose value is == to value (see Entry Order):
How to use
Quick guide
Official content
Official how?
I scraped all this data from the official documentation. I created this site to make it easier for beginners and more pleasant for professionals to use Ruby.
Georgie boy
Creator of ruby-docs.org
Returns a new 2-element Array consisting of the key and value of the first-found entry whose value is
==
to value (see Entry Order):h = {foo: 0, bar: 1, baz: 1}
h.rassoc(1) # => [:bar, 1]
Returns
nil
if no such value found.
static VALUE
rb_hash_rassoc(VALUE hash, VALUE obj)
{
VALUE args[2];
args[0] = obj;
args[1] = Qnil;
rb_hash_foreach(hash, rassoc_i, (VALUE)args);
return args[1];
}
Was this page useful?
Leave your feedback
Please hit 'submit' to confirm your feedback.
Leave your feedback
Please hit 'submit' to confirm your feedback.