RemoveMethod() публичный Метод

public RemoveMethod ( string name ) : bool
name string
Результат bool
Пример #1
0
 public static RubyModule /*!*/ RemoveMethod(RubyModule /*!*/ self, [DefaultProtocol] string /*!*/ methodName)
 {
     if (!self.RemoveMethod(methodName))
     {
         throw RubyExceptions.CreateUndefinedMethodError(self, methodName);
     }
     return(self);
 }
Пример #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);
        }
Пример #3
0
 public static RubyModule/*!*/ RemoveMethod(RubyModule/*!*/ self, [DefaultProtocol]string/*!*/ methodName) {
     if (!self.RemoveMethod(methodName)) {
         throw RubyExceptions.CreateUndefinedMethodError(self, methodName);
     }
     return self;
 }
Пример #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;
 }
Пример #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;
        }