core/src/main/java/org/jruby/RubyBasicObject.java
@Override
    public RubyInteger convertToInteger(String convertMethod) {
        if (convertMethod.equals("to_int")) return convertToInteger();

        IRubyObject result;
        Ruby runtime = metaClass.runtime;
        if (convertMethod.equals("to_i")) {
            ThreadContext context = runtime.getCurrentContext();
            BasicObjectSites sites = sites(context);
            result = TypeConverter.convertToType(context, this, runtime.getInteger(), sites.to_i_checked, true);
        } else {
            result = TypeConverter.convertToType(this, runtime.getInteger(), convertMethod, true);
        }

        if (!(result instanceof RubyInteger)) {
            throw runtime.newTypeError(str(runtime, types(runtime, getMetaClass()), "#", ids(runtime, convertMethod), " should return Integer"));
        }

        return (RubyInteger) result;
    }
/**
     * Tries to convert this object to a Ruby Integer using the supplied conversion method.
     * @param convertMethod conversion method to use e.g. "to_i"
     * @return an integer representation of this
     */
Tries to convert this object to a Ruby Integer using the supplied conversion method.
@param convertMethod conversion method to use e.g. "to_i"
@return an integer representation of this
Tries to convert this object to a Ruby Integer using the supplied conversion method . @param convertMethod conversion method to use e . g . " to_i " @return an integer representation of this
@Override
    public RubyInteger convertToInteger(String convertMethod) {
        if (convertMethod.equals("to_int")) return convertToInteger();
        IRubyObject result;
        Ruby runtime = metaClass.runtime;
        if (convertMethod.equals("to_i")) {
            ThreadContext context = runtime.getCurrentContext();
            BasicObjectSites sites = sites(context);
            result = TypeConverter.convertToType(context, this, runtime.getInteger(), sites.to_i_checked, true);
        } else {
            result = TypeConverter.convertToType(this, runtime.getInteger(), convertMethod, true);
        }
        if (!(result instanceof RubyInteger)) {
            throw runtime.newTypeError(str(runtime, types(runtime, getMetaClass()), "#", ids(runtime, convertMethod), " should return Integer"));
        }
        return (RubyInteger) result;
    }
@ Override public RubyInteger convertToInteger ( String convertMethod ) { if ( convertMethod . equals ( "to_int" ) ) return convertToInteger ( ) ; IRubyObject result ; Ruby runtime = metaClass . runtime ; if ( convertMethod . equals ( "to_i" ) ) { ThreadContext context = runtime . getCurrentContext ( ) ; BasicObjectSites sites = sites ( context ) ; result = TypeConverter . convertToType ( context , this , runtime . getInteger ( ) , sites . to_i_checked , true ) ; } else { result = TypeConverter . convertToType ( this , runtime . getInteger ( ) , convertMethod , true ) ; } if ( ! ( result instanceof RubyInteger ) ) { throw runtime . newTypeError ( str ( runtime , types ( runtime , getMetaClass ( ) ) , "#" , ids ( runtime , convertMethod ) , " should return Integer" ) ) ; } return ( RubyInteger ) result ; }
Tries to convert this object to a Ruby Integer using the supplied conversion method.
Tries to convert this object to a Ruby Integer using the supplied conversion method .