public static IRubyObject convertToType(ThreadContext context, IRubyObject obj, RubyClass target, String convertMethod, boolean raise) { IRubyObject r = obj.checkCallMethod(context, convertMethod); return r == null ? handleUncoercibleObject(context.runtime, obj, target, raise) : r; }
/** * Converts this object to type 'targetType' using 'convertMethod' method (MRI: convert_type 1.9). * * @param obj the object to convert * @param target is the type we are trying to convert to * @param sites is the CheckedSites call sites to be called to try and convert to targetType * @param raise will throw an Error if conversion does not work * @return the converted value */ public static IRubyObject convertToType(ThreadContext context, IRubyObject obj, RubyClass target, JavaSites.CheckedSites sites, boolean raise) { IRubyObject r = obj.checkCallMethod(context, sites); return r == null ? handleUncoercibleObject(context.runtime, obj, target, raise) : r; }
@Deprecated // not-used public static IRubyObject handleImplicitlyUncoercibleObject(boolean raise, IRubyObject obj, RubyClass target) { return handleUncoercibleObject(obj.getRuntime(), obj, target, raise); }
public static IRubyObject handleUncoercibleObject(boolean raise, IRubyObject obj, RubyClass target) { return handleUncoercibleObject(obj.getRuntime(), obj, target, raise); }
public static IRubyObject convertToType(ThreadContext context, IRubyObject obj, RubyClass target, String convertMethod, boolean raise) { IRubyObject r = obj.checkCallMethod(context, convertMethod); return r == null ? handleUncoercibleObject(context.runtime, obj, target, raise) : r; }
/** * Converts this object to type 'targetType' using 'convertMethod' method (MRI: convert_type 1.9). * * @param obj the object to convert * @param target is the type we are trying to convert to * @param sites is the CheckedSites call sites to be called to try and convert to targetType * @param raise will throw an Error if conversion does not work * @return the converted value */ public static IRubyObject convertToType(ThreadContext context, IRubyObject obj, RubyClass target, JavaSites.CheckedSites sites, boolean raise) { IRubyObject r = obj.checkCallMethod(context, sites); return r == null ? handleUncoercibleObject(context.runtime, obj, target, raise) : r; }
@Deprecated // not-used public static IRubyObject handleImplicitlyUncoercibleObject(boolean raise, IRubyObject obj, RubyClass target) { return handleUncoercibleObject(obj.getRuntime(), obj, target, raise); }
public static IRubyObject handleUncoercibleObject(boolean raise, IRubyObject obj, RubyClass target) { return handleUncoercibleObject(obj.getRuntime(), obj, target, raise); }
@Deprecated public static IRubyObject convertToType(IRubyObject obj, RubyClass target, int convertMethodIndex, String convertMethod, boolean raise) { if (!obj.respondsTo(convertMethod)) return handleUncoercibleObject(raise, obj, target); return obj.callMethod(obj.getRuntime().getCurrentContext(), convertMethod); }
@Deprecated public static IRubyObject convertToType(IRubyObject obj, RubyClass target, int convertMethodIndex, String convertMethod, boolean raise) { if (!obj.respondsTo(convertMethod)) return handleUncoercibleObject(raise, obj, target); return obj.callMethod(obj.getRuntime().getCurrentContext(), convertMethod); }
/** * Converts this object to type 'targetType' using 'convertMethod' method (MRI: convert_type). * * @param obj the object to convert * @param targetType is the type we are trying to convert to * @param convertMethodIndex the fast index to use for calling the method * @param convertMethod is the method to be called to try and convert to targeType * @param raiseOnError will throw an Error if conversion does not work * @return the converted value */ @Deprecated public static final IRubyObject convertToType(IRubyObject obj, RubyClass target, int convertMethodIndex, String convertMethod, boolean raise) { if (!obj.respondsTo(convertMethod)) return handleUncoercibleObject(raise, obj, target); return obj.callMethod(obj.getRuntime().getCurrentContext(), convertMethod); }
/** * Converts this object to type 'targetType' using 'convertMethod' method (MRI: convert_type 1.9). * * @param obj the object to convert * @param targetType is the type we are trying to convert to * @param convertMethodIndex the fast index to use for calling the method * @param convertMethod is the method to be called to try and convert to targeType * @param raiseOnError will throw an Error if conversion does not work * @return the converted value */ public static final IRubyObject convertToType19(IRubyObject obj, RubyClass target, String convertMethod, boolean raise) { IRubyObject r = obj.checkCallMethod(obj.getRuntime().getCurrentContext(), convertMethod); return r == null ? handleUncoercibleObject(raise, obj, target) : r; }
/** * Converts this object to type 'targetType' using 'convertMethod' method (MRI: convert_type 1.9). * * @param obj the object to convert * @param targetType is the type we are trying to convert to * @param convertMethodIndex the fast index to use for calling the method * @param convertMethod is the method to be called to try and convert to targeType * @param raiseOnError will throw an Error if conversion does not work * @return the converted value */ public static final IRubyObject convertToType19(IRubyObject obj, RubyClass target, String convertMethod, boolean raise) { IRubyObject r = obj.checkCallMethod(obj.getRuntime().getCurrentContext(), convertMethod); return r == null ? handleUncoercibleObject(raise, obj, target) : r; }
/** * Converts this object to type 'targetType' using 'convertMethod' method (MRI: convert_type). * * @param obj the object to convert * @param targetType is the type we are trying to convert to * @param convertMethodIndex the fast index to use for calling the method * @param convertMethod is the method to be called to try and convert to targeType * @param raiseOnError will throw an Error if conversion does not work * @return the converted value */ @Deprecated public static final IRubyObject convertToType(IRubyObject obj, RubyClass target, int convertMethodIndex, String convertMethod, boolean raise) { if (!obj.respondsTo(convertMethod)) return handleUncoercibleObject(raise, obj, target); return obj.callMethod(obj.getRuntime().getCurrentContext(), convertMethod); }
/** * Converts this object to type 'targetType' using 'convertMethod' method (MRI: convert_type). * * @param obj the object to convert * @param targetType is the type we are trying to convert to * @param convertMethodIndex the fast index to use for calling the method * @param convertMethod is the method to be called to try and convert to targeType * @param raiseOnError will throw an Error if conversion does not work * @return the converted value */ public static final IRubyObject convertToType(IRubyObject obj, RubyClass target, String convertMethod, boolean raise) { if (!obj.respondsTo(convertMethod)) return handleUncoercibleObject(raise, obj, target); return obj.callMethod(obj.getRuntime().getCurrentContext(), convertMethod); }
/** * Converts this object to type 'targetType' using 'convertMethod' method (MRI: convert_type). * * @param obj the object to convert * @param targetType is the type we are trying to convert to * @param convertMethodIndex the fast index to use for calling the method * @param convertMethod is the method to be called to try and convert to targeType * @param raiseOnError will throw an Error if conversion does not work * @return the converted value */ public static final IRubyObject convertToType(IRubyObject obj, RubyClass target, String convertMethod, boolean raise) { if (!obj.respondsTo(convertMethod)) return handleUncoercibleObject(raise, obj, target); return obj.callMethod(obj.getRuntime().getCurrentContext(), convertMethod); }
private static RubyFloat needFloat(IRubyObject x) { if (x instanceof RubyFloat) { return (RubyFloat)x; } if (!x.getRuntime().getNumeric().isInstance(x)) { TypeConverter.handleUncoercibleObject(true, x, x.getRuntime().getFloat()); } return (RubyFloat) TypeConverter.convertToType19(x, x.getRuntime().getFloat(), "to_f", true); }
private static RubyFloat needFloat(IRubyObject x) { if (x instanceof RubyFloat) { return (RubyFloat)x; } if (!x.getRuntime().getNumeric().isInstance(x)) { TypeConverter.handleUncoercibleObject(true, x, x.getRuntime().getFloat()); } return (RubyFloat) TypeConverter.convertToType19(x, x.getRuntime().getFloat(), "to_f", true); }
TypeConverter.handleUncoercibleObject(context.runtime, _timeout, context.runtime.getFloat(), true); throw e; // won't happen
TypeConverter.handleUncoercibleObject(context.runtime, _timeout, context.runtime.getFloat(), true); throw e; // won't happen