RemoveMethod() public method

public RemoveMethod ( string name ) : bool
name string
return bool
Ejemplo n.º 1
0
 public static RubyModule /*!*/ RemoveMethod(RubyModule /*!*/ self, [DefaultProtocol] string /*!*/ methodName)
 {
     if (!self.RemoveMethod(methodName))
     {
         throw RubyExceptions.CreateUndefinedMethodError(self, methodName);
     }
     return(self);
 }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
 public static RubyModule/*!*/ RemoveMethod(RubyModule/*!*/ self, [DefaultProtocol]string/*!*/ methodName) {
     if (!self.RemoveMethod(methodName)) {
         throw RubyExceptions.CreateUndefinedMethodError(self, methodName);
     }
     return self;
 }
Ejemplo n.º 4
0
 public static RubyModule/*!*/ RemoveMethod(RubyModule/*!*/ self, [DefaultProtocol, NotNull]string/*!*/ methodName) {
     // MRI 1.8: reports a warning and allows removal
     // MRI 1.9: throws a NameError
     if (self == self.Context.ObjectClass && methodName == Symbols.Initialize) {
         throw RubyExceptions.CreateNameError("Cannot remove Object#initialize");
     }
     if (!self.RemoveMethod(methodName)) {
         throw RubyExceptions.CreateUndefinedMethodError(self, methodName);
     }
     return self;
 }
Ejemplo n.º 5
0
        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;
        }