public static Exception /*!*/ MethodShouldReturnType(RubyContext /*!*/ context, object param, string /*!*/ method, string /*!*/ targetType) { Assert.NotNull(context, method, targetType); return(new InvalidOperationException(String.Format("{0}#{1} should return {2}", RubyUtils.GetClassName(context, param), method, targetType ))); }
private static string /*!*/ FormatMethodMissingMessage(RubyContext /*!*/ context, object self, string /*!*/ name, string /*!*/ message) { Assert.NotNull(name); string strObject; if (self == null) { strObject = "nil:NilClass"; } else { strObject = RubySites.ToS(context, self).ConvertToString(); if (!strObject.StartsWith("#")) { strObject += ":" + RubyUtils.GetClassName(context, self); } } return(String.Format(message, name, strObject)); }
private object RequireWriteProtocol(RubyContext /*!*/ context, object value, string /*!*/ variableName) { if (!RubySites.RespondTo(context, value, "write")) { throw RubyExceptions.CreateTypeError(String.Format("${0} must have write method, {1} given", variableName, RubyUtils.GetClassName(context, value))); } return(value); }
public static Exception /*!*/ CannotConvertTypeToTargetType(RubyContext /*!*/ context, object param, string /*!*/ toType) { Assert.NotNull(context, toType); return(CreateTypeConversionError(RubyUtils.GetClassName(context, param), toType)); }
public static Exception /*!*/ CreateUnexpectedTypeError(RubyContext /*!*/ context, object param, string /*!*/ type) { return(CreateTypeError(String.Format("wrong argument type {0} (expected {1})", RubyUtils.GetClassName(context, param), type))); }