private RemoveMethod ( RubyModule self ) : RubyModule | ||
self | RubyModule | |
return | RubyModule |
public static RubyModule/*!*/ RemoveMethod(RubyModule/*!*/ self, [DefaultProtocol, NotNullItems]params string[]/*!*/ methodNames) {
foreach (var methodName in methodNames) {
// MRI: reports a warning and allows removal
if (self.IsBasicObjectClass && methodName == Symbols.Initialize) {
throw RubyExceptions.CreateNameError("Cannot remove BasicObject#initialize");
}
if (!self.RemoveMethod(methodName)) {
throw RubyExceptions.CreateUndefinedMethodError(self, methodName);
}
}
return self;
}