summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-09-26 07:07:13 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-09-26 07:07:13 +0000
commitc7a316947f8f9249afb4ed043034bdfb7fdd3951 (patch)
tree5ec5a7a32d24f966c45c3534dc0ff07acd0438cf /object.c
parent684a768ef5e1859d5e2b95031576c06017277e9e (diff)
matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@975 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'object.c')
-rw-r--r--object.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/object.c b/object.c
index fe9f8ad..3574c6f 100644
--- a/object.c
+++ b/object.c
@@ -113,7 +113,6 @@ rb_obj_dup(obj)
}
if (!SPECIAL_CONST_P(dup)) {
OBJSETUP(dup, rb_obj_type(obj), BUILTIN_TYPE(obj));
- OBJ_INFECT(dup, obj);
}
return dup;
}
@@ -471,7 +470,6 @@ rb_obj_alloc(klass)
{
NEWOBJ(obj, struct RObject);
OBJSETUP(obj, klass, T_OBJECT);
- obj->iv_tbl = 0;
return (VALUE)obj;
}
@@ -531,6 +529,15 @@ rb_mod_clone(module)
}
static VALUE
+rb_mod_dup(module)
+ VALUE module;
+{
+ VALUE dup = rb_mod_clone(module);
+ OBJSETUP(dup, RBASIC(module)->klass, BUILTIN_TYPE(module));
+ return dup;
+}
+
+static VALUE
rb_mod_to_s(klass)
VALUE klass;
{
@@ -1153,6 +1160,7 @@ Init_Object()
rb_define_method(rb_cModule, ">", rb_mod_gt, 1);
rb_define_method(rb_cModule, ">=", rb_mod_ge, 1);
rb_define_method(rb_cModule, "clone", rb_mod_clone, 0);
+ rb_define_method(rb_cModule, "dup", rb_mod_dup, 0);
rb_define_method(rb_cModule, "to_s", rb_mod_to_s, 0);
rb_define_method(rb_cModule, "included_modules", rb_mod_included_modules, 0);
rb_define_method(rb_cModule, "name", rb_mod_name, 0);