Beispiel #1
0
static VALUE
rb_thread_key_p(VALUE self, SEL sel, VALUE key)
{
    key = ID2SYM(rb_to_id(key));
    VALUE h = rb_vm_thread_locals(self, false);
    if (h == Qnil) {
	return Qfalse;
    }
    return rb_hash_has_key(h, key);
}
Beispiel #2
0
VALUE rb_ivar_defined(VALUE obj, ID id) {
  VALUE ivar_table, inner_table;
  if(is_instance_id(id)) {
    return rb_obj_ivar_defined_p(obj, ID2SYM(id));
  }
  /* TODO
  switch (TYPE(obj)) {
  case T_OBJECT:
  case T_CLASS:
  case T_MODULE:
    rb_raise(rb_eNotImpError, "TODO: rb_ivar_get(obj_or_class_or_mod, :not_ivar_name, val) is not implemented yet.");
  }
   */
  ivar_table = rb_eval_string("$__loadso__ivar_table");
  inner_table = rb_hash_aref(ivar_table, obj);
  if(inner_table) {
    return rb_hash_has_key(inner_table, ID2SYM(id));
  }
  return Qfalse;
}