public static IRubyObject checkIntegerType(ThreadContext context, IRubyObject obj) { if (obj instanceof RubyFixnum) return obj; TypeConverterSites sites = sites(context); IRubyObject conv = convertToTypeWithCheck(context, obj, context.runtime.getInteger(), sites.to_int_checked); return conv instanceof RubyInteger ? conv : context.nil; }
public static IRubyObject checkIntegerType(ThreadContext context, IRubyObject obj) { if (obj instanceof RubyFixnum) return obj; TypeConverterSites sites = sites(context); IRubyObject conv = convertToTypeWithCheck(context, obj, context.runtime.getInteger(), sites.to_int_checked); return conv instanceof RubyInteger ? conv : context.nil; }
public static RubyArray to_ary(ThreadContext context, IRubyObject ary) { return (RubyArray) convertToType(context, ary, context.runtime.getArray(), sites(context).to_ary_checked); }
public static RubyArray to_ary(ThreadContext context, IRubyObject ary) { return (RubyArray) convertToType(context, ary, context.runtime.getArray(), sites(context).to_ary_checked); }
public static IRubyObject checkArrayType(ThreadContext context, IRubyObject obj) { return TypeConverter.convertToTypeWithCheck(context, obj, context.runtime.getArray(), sites(context).to_ary_checked); }
public static IRubyObject checkArrayType(ThreadContext context, IRubyObject obj) { return TypeConverter.convertToTypeWithCheck(context, obj, context.runtime.getArray(), sites(context).to_ary_checked); }
public static IRubyObject checkFloatType(Ruby runtime, IRubyObject obj) { if (obj instanceof RubyFloat) return obj; ThreadContext context = runtime.getCurrentContext(); TypeConverterSites sites = sites(context); return TypeConverter.convertToTypeWithCheck(context, obj, runtime.getFloat(), sites.to_f_checked); }
public static IRubyObject checkFloatType(Ruby runtime, IRubyObject obj) { if (obj instanceof RubyFloat) return obj; ThreadContext context = runtime.getCurrentContext(); TypeConverterSites sites = sites(context); return TypeConverter.convertToTypeWithCheck(context, obj, runtime.getFloat(), sites.to_f_checked); }
public static RubyArray rb_Array(ThreadContext context, IRubyObject val) { IRubyObject tmp = checkArrayType(context, val); // to_ary if (tmp == context.nil) { TypeConverterSites sites = sites(context); tmp = convertToTypeWithCheck(context, val, context.runtime.getArray(), sites.to_a_checked); if (tmp == context.nil) { return context.runtime.newArray(val); } } return (RubyArray) tmp; }
public static RubyArray rb_Array(ThreadContext context, IRubyObject val) { IRubyObject tmp = checkArrayType(context, val); // to_ary if (tmp == context.nil) { TypeConverterSites sites = sites(context); tmp = convertToTypeWithCheck(context, val, context.runtime.getArray(), sites.to_a_checked); if (tmp == context.nil) { return context.runtime.newArray(val); } } return (RubyArray) tmp; }
public static IRubyObject checkIntegerType(Ruby runtime, IRubyObject obj, String method) { if (method.equals("to_int")) return checkIntegerType(runtime.getCurrentContext(), obj); if (obj instanceof RubyFixnum) return obj; if (method.equals("to_i")) { ThreadContext context = runtime.getCurrentContext(); TypeConverterSites sites = sites(context); IRubyObject conv = convertToTypeWithCheck(context, obj, runtime.getInteger(), sites.to_i_checked); return conv instanceof RubyInteger ? conv : runtime.getNil(); } IRubyObject conv = TypeConverter.convertToType(obj, runtime.getInteger(), method, false); return conv instanceof RubyInteger ? conv : runtime.getNil(); }
public static IRubyObject checkIntegerType(Ruby runtime, IRubyObject obj, String method) { if (method.equals("to_int")) return checkIntegerType(runtime.getCurrentContext(), obj); if (obj instanceof RubyFixnum) return obj; if (method.equals("to_i")) { ThreadContext context = runtime.getCurrentContext(); TypeConverterSites sites = sites(context); IRubyObject conv = convertToTypeWithCheck(context, obj, runtime.getInteger(), sites.to_i_checked); return conv instanceof RubyInteger ? conv : runtime.getNil(); } IRubyObject conv = TypeConverter.convertToType(obj, runtime.getInteger(), method, false); return conv instanceof RubyInteger ? conv : runtime.getNil(); }