本文整理汇总了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;
}
示例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);
}
示例3: IsNotSubclassSameOrIncluded
public static object IsNotSubclassSameOrIncluded(RubyModule/*!*/ self, [NotNull]RubyModule/*!*/ module) {
if (module.HasAncestor(self)) {
return true;
}
return self.HasAncestor(module) ? ScriptingRuntimeHelpers.False : null;
}
示例4: IsSubclassOrIncluded
public static object IsSubclassOrIncluded(RubyModule/*!*/ self, [NotNull]RubyModule/*!*/ module) {
if (ReferenceEquals(self, module)) {
return false;
}
return self.HasAncestor(module) ? ScriptingRuntimeHelpers.True : null;
}
示例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;
}
示例6: IncludesModule
public static bool IncludesModule(RubyModule/*!*/ self, [NotNull]RubyModule/*!*/ other) {
RubyUtils.RequireNonClasses(other);
return other != self && self.HasAncestor(other);
}
示例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;
}