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
コード例 #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);
        }
コード例 #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));
        }
コード例 #3
0
ファイル: ModuleOps.cs プロジェクト: ife/IronLanguages
 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);
 }
コード例 #4
0
ファイル: ModuleOps.cs プロジェクト: ife/IronLanguages
        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));
        }
コード例 #5
0
ファイル: ModuleOps.cs プロジェクト: aslakhellesoy/ironruby
        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);
        }
コード例 #6
0
ファイル: ModuleOps.cs プロジェクト: aslakhellesoy/ironruby
 public static bool PublicMethodDefined(RubyModule/*!*/ self, [DefaultProtocol]string/*!*/ methodName) {
     RubyMemberInfo method = self.ResolveMethod(methodName, true);
     return method != null && method.Visibility == RubyMethodVisibility.Public;
 }
コード例 #7
0
ファイル: ModuleOps.cs プロジェクト: aslakhellesoy/ironruby
 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;
 }
コード例 #8
0
        public static bool PublicMethodDefined(RubyModule /*!*/ self, [DefaultProtocol] string /*!*/ methodName)
        {
            RubyMemberInfo method = self.ResolveMethod(methodName, true);

            return(method != null && method.Visibility == RubyMethodVisibility.Public);
        }
コード例 #9
0
ファイル: ModuleOps.cs プロジェクト: atczyc/ironruby
        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);
        }
コード例 #10
0
ファイル: ModuleOps.cs プロジェクト: ife/IronLanguages
        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);
        }
コード例 #11
0
ファイル: ModuleOps.cs プロジェクト: atczyc/ironruby
 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;
 }
コード例 #12
0
ファイル: ModuleOps.cs プロジェクト: atczyc/ironruby
 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;
 }
コード例 #13
0
ファイル: ModuleOps.cs プロジェクト: jcteague/ironruby
 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;
 }
コード例 #14
0
ファイル: ModuleOps.cs プロジェクト: octavioh/ironruby
 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;
 }
コード例 #15
0
ファイル: ModuleOps.cs プロジェクト: TerabyteX/main
 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;
 }