APIdock / Ruby
/
method

allocation_class_path

ruby latest stable - Class: ObjectSpace
allocation_class_path(p1)
public

Returns the class for the given object.

class A
 def foo
 ObjectSpace ::trace_object_allocations  do
 obj = Object .new
 p "#{ObjectSpace::allocation_class_path(obj)}"
 end
 end
end
A.new.foo #=> "Class"

See ::trace_object_allocations for more information and examples.

static VALUE
allocation_class_path(VALUE self, VALUE obj)
{
 struct allocation_info *info = lookup_allocation_info(obj);
 if (info && info->class_path) {
 return rb_str_new2(info->class_path);
 }
 else {
 return Qnil;
 }
}

AltStyle によって変換されたページ (->オリジナル) /