key?(p1)
public
Returns true if the given string (or symbol) exists as a
thread-local variable.
me = Thread.current
me[:oliver] = "a"
me.key?(:oliver)
me.key?(:stanley)
Show source
/*
* call-seq:
* thr.key?(sym) => true or false
*
* Returns <code>true</code> if the given string (or symbol) exists as a
* thread-local variable.
*
* me = Thread.current
* me[:oliver] = "a"
* me.key?(:oliver)
* me.key?(:stanley)
*/
static VALUE
rb_thread_key_p(thread, id)
VALUE thread, id;
{
rb_thread_t th = rb_thread_check(thread);
if (!th->locals) return Qfalse;
if (st_lookup(th->locals, rb_to_id(id), 0))
return Qtrue;
return Qfalse;
}