summaryrefslogtreecommitdiff
path: root/class.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-10-24 01:49:52 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-10-24 01:49:52 +0000
commit4065c38a6af728c134035a1adc6add3a7a7e6ed1 (patch)
tree2e22d471f9435552adf4ae9bc6de4041bca3312a /class.c
parent3bda73868f66e3cc24628a9dcce0568363ff2337 (diff)
class.c: rb_undef_methods_from
* class.c (rb_undef_methods_from): undefine methods defined in super from klass. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56482 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'class.c')
-rw-r--r--class.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/class.c b/class.c
index 8a3a708..d1a1379 100644
--- a/class.c
+++ b/class.c
@@ -1528,6 +1528,23 @@ rb_undef_method(VALUE klass, const char *name)
rb_add_method(klass, rb_intern(name), VM_METHOD_TYPE_UNDEF, 0, METHOD_VISI_UNDEF);
}
+static enum rb_id_table_iterator_result
+undef_method_i(ID name, VALUE value, void *data)
+{
+ VALUE klass = (VALUE)data;
+ rb_add_method(klass, name, VM_METHOD_TYPE_UNDEF, 0, METHOD_VISI_UNDEF);
+ return ID_TABLE_CONTINUE;
+}
+
+void
+rb_undef_methods_from(VALUE klass, VALUE super)
+{
+ struct rb_id_table *mtbl = RCLASS_M_TBL(super);
+ if (mtbl) {
+ rb_id_table_foreach(mtbl, undef_method_i, (void *)klass);
+ }
+}
+
/*!
* \}
*/