Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
Method#box
meth.box → box or nil
proc.c
View on GitHub ↗
static VALUE
method_box(VALUE obj)
{
struct METHOD *data;
const rb_box_t *box;
TypedData_Get_Struct(obj, struct METHOD, &method_data_type, data);
box = data->me->def->box;
if (!box) return Qnil;
if (box->box_object) return box->box_object;
rb_bug("Unexpected box on the method definition: %p", (void*) box);
UNREACHABLE_RETURN(Qnil);
}
Returns the Ruby::Box where meth is defined in.