public static object IsNotSubclassSameOrIncluded(RubyModule /*!*/ self, [NotNull] RubyModule /*!*/ module) { if (module.HasAncestor(self)) { return(true); } return(self.HasAncestor(module) ? ScriptingRuntimeHelpers.False : null); }
public static object IsNotSubclassOrIncluded(RubyModule /*!*/ self, [NotNull] RubyModule /*!*/ module) { if (ReferenceEquals(self, module)) { return(false); } return(module.HasAncestor(self) ? ScriptingRuntimeHelpers.True : null); }
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)); }
public static UnboundMethod /*!*/ DefineMethod(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.Name) ); } self.AddDefinedMethod(methodName, method.Info); return(method); }
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); }
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); }
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; }
public static object IsNotSubclassSameOrIncluded(RubyModule/*!*/ self, [NotNull]RubyModule/*!*/ module) { if (module.HasAncestor(self)) { return true; } return self.HasAncestor(module) ? ScriptingRuntimeHelpers.False : null; }
public static object IsSubclassOrIncluded(RubyModule/*!*/ self, [NotNull]RubyModule/*!*/ module) { if (ReferenceEquals(self, module)) { return false; } return self.HasAncestor(module) ? ScriptingRuntimeHelpers.True : null; }
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; }
public static bool IncludesModule(RubyModule /*!*/ self, [NotNull] RubyModule /*!*/ other) { RubyUtils.RequireNonClasses(other); return(other != self && self.HasAncestor(other)); }
public static bool IncludesModule(RubyModule/*!*/ self, [NotNull]RubyModule/*!*/ other) { RubyUtils.RequireNonClasses(other); return other != self && self.HasAncestor(other); }
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; }