aboutsummaryrefslogtreecommitdiffstats
path: root/vm_method.c
diff options
context:
space:
mode:
Diffstat (limited to 'vm_method.c')
-rw-r--r--vm_method.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/vm_method.c b/vm_method.c
index f3da623347..8c606d410c 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -1402,3 +1402,18 @@ Init_eval_method(void)
}
}
+int
+rb_method_defined_by(VALUE obj, ID mid, VALUE (*cfunc)(ANYARGS))
+{
+ rb_method_entry_t *me = search_method(CLASS_OF(obj), mid);
+
+ if (me && me->def &&
+ me->def->type == VM_METHOD_TYPE_CFUNC &&
+ me->def->body.cfunc.func == cfunc) {
+ return 1;
+ }
+ else {
+ return 0;
+ }
+}
+