protected object ruby_dup(RBasic r, params object[] args) { RBasic dup = (RBasic)ruby.Funcall(r, "clone", null); if (dup.GetType() != r.GetType()) { throw new eTypeError("duplicated object must be same type"); } if (dup.IsSpecialConst == false) { dup.klass = r.klass; dup.flags = r.flags; dup.Infect(r); } return(dup); }