method

index

v2_1_10 - Show latest stable - Class: Hash
index(p1)
public

No documentation available.

static VALUE
rb_hash_index(VALUE hash, VALUE value)
{
    rb_warn("Hash#index is deprecated; use Hash#key");
    return rb_hash_key(hash, value);
}

1Note

Potentially slow operation

szeryf ยท May 27, 2009

Remember that checking for a value is a potentially slow operation (all the elements might be iterated) as oposed to querying a key (e.g. with has_key?), which is supposed to be fast in a Hash.