summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-02-23 05:23:12 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-02-23 05:23:12 +0000
commitbf70582cf30ae6f715769c519f451411f5d2a577 (patch)
treeb3eb8e2975df384946ad70572e1e3387a6c3127c /eval.c
parent6f82a67fd0035fcd2802f1564165d5211bc98ea2 (diff)
2000-02-23
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@624 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/eval.c b/eval.c
index b913680eb0..d7895453a7 100644
--- a/eval.c
+++ b/eval.c
@@ -5958,6 +5958,21 @@ rb_obj_method(obj, vid)
}
static VALUE
+method_clone(self)
+ VALUE self;
+{
+ VALUE clone;
+ struct METHOD *orig, *data;
+
+ Data_Get_Struct(self, struct METHOD, orig);
+ clone = Data_Make_Struct(rb_cMethod,struct METHOD,bm_mark,free,data);
+ CLONESETUP(clone, self);
+ *data = *orig;
+
+ return clone;
+}
+
+static VALUE
method_call(argc, argv, method)
int argc;
VALUE *argv;
@@ -6094,6 +6109,7 @@ Init_Proc()
rb_cMethod = rb_define_class("Method", rb_cObject);
rb_undef_method(CLASS_OF(rb_cMethod), "new");
+ rb_define_method(rb_cMethod, "clone", method_clone, 0);
rb_define_method(rb_cMethod, "call", method_call, -1);
rb_define_method(rb_cMethod, "[]", method_call, -1);
rb_define_method(rb_cMethod, "arity", method_arity, 0);