当前位置: 首页>>代码示例>>C#>>正文


C# RubyModule.HasAncestor方法代码示例

本文整理汇总了C#中IronRuby.Builtins.RubyModule.HasAncestor方法的典型用法代码示例。如果您正苦于以下问题:C# RubyModule.HasAncestor方法的具体用法?C# RubyModule.HasAncestor怎么用?C# RubyModule.HasAncestor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IronRuby.Builtins.RubyModule的用法示例。


在下文中一共展示了RubyModule.HasAncestor方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Comparison

        public static object Comparison(RubyModule/*!*/ self, [NotNull]RubyModule/*!*/ module) {
            if (ReferenceEquals(self, module)) {
                return ScriptingRuntimeHelpers.Int32ToObject(0);
            }

            if (self.HasAncestor(module)) {
                return ScriptingRuntimeHelpers.Int32ToObject(-1);
            }

            if (module.HasAncestor(self)) {
                return ScriptingRuntimeHelpers.Int32ToObject(1);
            }

            return null;
        }
开发者ID:aslakhellesoy,项目名称:ironruby,代码行数:15,代码来源:ModuleOps.cs

示例2: IncludesModule

        public static bool IncludesModule(RubyModule/*!*/ self, [NotNull]RubyModule/*!*/ other) {
            if (other.IsClass) {
                throw RubyExceptions.CreateTypeError("wrong argument type Class (expected Module)");
            }

            return other != self && self.HasAncestor(other);
        }
开发者ID:aslakhellesoy,项目名称:ironruby,代码行数:7,代码来源:ModuleOps.cs

示例3: IsNotSubclassSameOrIncluded

 public static object IsNotSubclassSameOrIncluded(RubyModule/*!*/ self, [NotNull]RubyModule/*!*/ module) {
     if (module.HasAncestor(self)) {
         return true;
     }
     return self.HasAncestor(module) ? ScriptingRuntimeHelpers.False : null;
 }
开发者ID:aslakhellesoy,项目名称:ironruby,代码行数:6,代码来源:ModuleOps.cs

示例4: IsSubclassOrIncluded

 public static object IsSubclassOrIncluded(RubyModule/*!*/ self, [NotNull]RubyModule/*!*/ module) {
     if (ReferenceEquals(self, module)) {
         return false;
     }
     return self.HasAncestor(module) ? ScriptingRuntimeHelpers.True : null;
 }
开发者ID:aslakhellesoy,项目名称:ironruby,代码行数:6,代码来源:ModuleOps.cs

示例5: DefineMethod

        public static UnboundMethod/*!*/ DefineMethod(RubyContext/*!*/ context, RubyModule/*!*/ self, 
            [DefaultProtocol]string/*!*/ methodName, [NotNull]UnboundMethod/*!*/ method) {

            // MRI 1.8 does the check when the method is called, 1.9 checks it upfront as we do:
            if (!self.HasAncestor(method.TargetConstraint)) {
                throw RubyExceptions.CreateTypeError(
                    String.Format("bind argument must be a subclass of {0}", method.TargetConstraint.GetName(context))
                );
            }

            self.AddDefinedMethod(context, methodName, method.Info);
            return method;
        }
开发者ID:aslakhellesoy,项目名称:ironruby,代码行数:13,代码来源:ModuleOps.cs

示例6: IncludesModule

        public static bool IncludesModule(RubyModule/*!*/ self, [NotNull]RubyModule/*!*/ other) {
            RubyUtils.RequireNonClasses(other);

            return other != self && self.HasAncestor(other);
        }
开发者ID:mscottford,项目名称:ironruby,代码行数:5,代码来源:ModuleOps.cs

示例7: DefineMethod

        public static RubyMethod/*!*/ DefineMethod(RubyModule/*!*/ self, 
            [DefaultProtocol]string/*!*/ methodName, [NotNull]RubyMethod/*!*/ method) {

            // MRI 1.8 does the check when the method is called, 1.9 checks it upfront as we do:
            var targetClass = method.GetTargetClass();
            if (!self.HasAncestor(targetClass)) {
                throw RubyExceptions.CreateTypeError(
                    String.Format("bind argument must be a subclass of {0}", targetClass.Name)
                );
            }

            self.AddDefinedMethod(methodName, method.Info);
            return method;
        }
开发者ID:mscottford,项目名称:ironruby,代码行数:14,代码来源:ModuleOps.cs


注:本文中的IronRuby.Builtins.RubyModule.HasAncestor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。