ResolveMethod() public method

public ResolveMethod ( string name, VisibilityContext visibility ) : IronRuby.Runtime.Calls.MethodResolutionResult
name string
visibility IronRuby.Runtime.Calls.VisibilityContext
return IronRuby.Runtime.Calls.MethodResolutionResult
Exemplo n.º 1
0
        public static RubyModule /*!*/ UndefineMethod(RubyModule /*!*/ self, [DefaultProtocol] string /*!*/ methodName)
        {
            RubyMemberInfo method = self.ResolveMethod(methodName, true);

            if (method == null)
            {
                throw RubyExceptions.CreateUndefinedMethodError(self, methodName);
            }
            self.UndefineMethod(methodName);
            return(self);
        }
Exemplo n.º 2
0
        public static UnboundMethod /*!*/ GetInstanceMethod(RubyModule /*!*/ self, [DefaultProtocol] string /*!*/ methodName)
        {
            RubyMemberInfo method = self.ResolveMethod(methodName, true);

            if (method == null)
            {
                throw RubyExceptions.CreateUndefinedMethodError(self, methodName);
            }

            // unbound method binable to any class with "self" mixin:
            return(new UnboundMethod(self, methodName, method));
        }
Exemplo n.º 3
0
 public static RubyModule /*!*/ UndefineMethod(RubyModule /*!*/ self, [DefaultProtocol, NotNullItems] params string[] /*!*/ methodNames)
 {
     foreach (var methodName in methodNames)
     {
         if (!self.ResolveMethod(methodName, VisibilityContext.AllVisible).Found)
         {
             throw RubyExceptions.CreateUndefinedMethodError(self, methodName);
         }
         self.UndefineMethod(methodName);
     }
     return(self);
 }
Exemplo n.º 4
0
        public static UnboundMethod /*!*/ GetInstanceMethod(RubyModule /*!*/ self, [DefaultProtocol, NotNull] string /*!*/ methodName)
        {
            RubyMemberInfo method = self.ResolveMethod(methodName, VisibilityContext.AllVisible).Info;

            if (method == null)
            {
                throw RubyExceptions.CreateUndefinedMethodError(self, methodName);
            }

            RubyModule constraint = self;

            if (self.IsSingletonClass && method.DeclaringModule != self)
            {
                constraint = ((RubyClass)self).SuperClass;
            }

            // unbound method binable to any class with "constraint" mixin:
            return(new UnboundMethod(constraint, methodName, method));
        }
Exemplo n.º 5
0
        public static UnboundMethod/*!*/ GetInstanceMethod(RubyModule/*!*/ self, [DefaultProtocol]string/*!*/ methodName) {
            RubyMemberInfo method = self.ResolveMethod(methodName, true);
            if (method == null) {
                throw RubyExceptions.CreateUndefinedMethodError(self, methodName);
            }

            // unbound method binable to any class with "self" mixin:
            return new UnboundMethod(self, methodName, method);
        }
Exemplo n.º 6
0
 public static bool PublicMethodDefined(RubyModule/*!*/ self, [DefaultProtocol]string/*!*/ methodName) {
     RubyMemberInfo method = self.ResolveMethod(methodName, true);
     return method != null && method.Visibility == RubyMethodVisibility.Public;
 }
Exemplo n.º 7
0
 public static RubyModule/*!*/ UndefineMethod(RubyModule/*!*/ self, [DefaultProtocol]string/*!*/ methodName) {
     RubyMemberInfo method = self.ResolveMethod(methodName, true);
     if (method == null) {
         throw RubyExceptions.CreateUndefinedMethodError(self, methodName);
     }
     self.UndefineMethod(methodName);
     return self;
 }
Exemplo n.º 8
0
        public static bool PublicMethodDefined(RubyModule /*!*/ self, [DefaultProtocol] string /*!*/ methodName)
        {
            RubyMemberInfo method = self.ResolveMethod(methodName, true);

            return(method != null && method.Visibility == RubyMethodVisibility.Public);
        }
Exemplo n.º 9
0
        public static UnboundMethod/*!*/ GetInstanceMethod(RubyModule/*!*/ self, [DefaultProtocol, NotNull]string/*!*/ methodName) {
            RubyMemberInfo method = self.ResolveMethod(methodName, VisibilityContext.AllVisible).Info;
            if (method == null) {
                throw RubyExceptions.CreateUndefinedMethodError(self, methodName);
            }

            RubyModule constraint = self;
            if (self.IsSingletonClass && method.DeclaringModule != self) {
                constraint = ((RubyClass)self).SuperClass;
            }

            // unbound method binable to any class with "constraint" mixin:
            return new UnboundMethod(constraint, methodName, method);
        }
Exemplo n.º 10
0
        public static bool PublicMethodDefined(RubyModule /*!*/ self, [DefaultProtocol, NotNull] string /*!*/ methodName)
        {
            RubyMemberInfo method = self.ResolveMethod(methodName, VisibilityContext.AllVisible).Info;

            return(method != null && method.Visibility == RubyMethodVisibility.Public);
        }
Exemplo n.º 11
0
 public static bool PublicMethodDefined(RubyModule/*!*/ self, [DefaultProtocol, NotNull]string/*!*/ methodName) {
     RubyMemberInfo method = self.ResolveMethod(methodName, VisibilityContext.AllVisible).Info;
     return method != null && method.Visibility == RubyMethodVisibility.Public;
 }
Exemplo n.º 12
0
 public static RubyModule/*!*/ UndefineMethod(RubyModule/*!*/ self, [DefaultProtocol, NotNull]string/*!*/ methodName) {
     if (!self.ResolveMethod(methodName, VisibilityContext.AllVisible).Found) {
         throw RubyExceptions.CreateUndefinedMethodError(self, methodName);
     }
     self.UndefineMethod(methodName);
     return self;
 }
Exemplo n.º 13
0
 public static bool ProtectedMethodDefined(RubyModule/*!*/ self, [DefaultProtocol, NotNull]string/*!*/ methodName) {
     RubyMemberInfo method = self.ResolveMethod(methodName, RubyClass.IgnoreVisibility).Info;
     return method != null && method.Visibility == RubyMethodVisibility.Protected;
 }
Exemplo n.º 14
0
 public static RubyModule/*!*/ UndefineMethod(RubyModule/*!*/ self, [DefaultProtocol]string/*!*/ methodName) {
     if (!self.ResolveMethod(methodName, true).Found) {
         throw RubyExceptions.CreateUndefinedMethodError(self, methodName);
     }
     self.UndefineMethod(methodName);
     return self;
 }
Exemplo n.º 15
0
 public static RubyModule UndefineMethod(RubyModule/*!*/ self, [DefaultProtocol, NotNullItems]params string[]/*!*/ methodNames)
 {
     foreach (var methodName in methodNames) {
         if (!self.ResolveMethod(methodName, VisibilityContext.AllVisible).Found) {
             throw RubyExceptions.CreateUndefinedMethodError(self, methodName);
         }
         self.UndefineMethod(methodName);
     }
     return self;
 }