respond_to?(p1, p2 = v2)
public
Returns true if obj responds to the given method. Private methods are included in the search only if
the optional second parameter evaluates to true.
Show source
static VALUE
obj_respond_to(int argc, VALUE *argv, VALUE obj)
{
VALUE mid, priv;
ID id;
rb_scan_args(argc, argv, "11", &mid, &priv);
id = rb_to_id(mid);
if (rb_method_boundp(CLASS_OF(obj), id, !RTEST(priv))) {
return Qtrue;
}
return Qfalse;
}