APIdock / Ruby
/
method

super_method

ruby latest stable - Class: Method
super_method()
public

Returns a Method of superclass which would be called when super is used or nil if there is no method on superclass.

static VALUE
method_super_method(VALUE method)
{
 const struct METHOD *data;
 VALUE super_class, iclass;
 ID mid;
 const rb_method_entry_t *me;
 TypedData_Get_Struct(method, struct METHOD, &method_data_type, data);
 iclass = data->iclass;
 if (!iclass) return Qnil;
 super_class = RCLASS_SUPER(RCLASS_ORIGIN(iclass));
 mid = data->me->called_id;
 if (!super_class) return Qnil;
 me = (rb_method_entry_t *)rb_callable_method_entry_without_refinements(super_class, mid, &iclass);
 if (!me) return Qnil;
 return mnew_internal(me, me->owner, iclass, data->recv, mid, rb_obj_class(method), FALSE, FALSE);
}

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