Package org.jruby.runtime.builtin

Examples of org.jruby.runtime.builtin.IRubyObject.convertToString()


                        }

                        IRubyObject from = list.eltInternal(idx++);
                        if(from.isTaint()) taintOutput = true;

                        lCurElemString = from == runtime.getNil() ? ByteList.EMPTY_BYTELIST : from.convertToString().getByteList();

                        if (isStar) {
                            occurrences = lCurElemString.length();
                            // 'Z' adds extra null pad (versus 'a')
                            if (type == 'Z') occurrences++;
View Full Code Here


                case 'm' : {
                        if (listSize-- <= 0) throw runtime.newArgumentError(sTooFew);

                        IRubyObject from = list.eltInternal(idx++);
                        if (from == runtime.getNil()) throw runtime.newTypeError(from, "Integer");
                        lCurElemString = from.convertToString().getByteList();
                        if (occurrences == 0 && type == 'm' && !ignoreStar) {
                            encodes(runtime, result, lCurElemString.getUnsafeBytes(),
                                    lCurElemString.getBegin(), lCurElemString.length(),
                                    lCurElemString.length(), (byte)type, false);
                            break;
View Full Code Here

        switch (args.length) {
        case 2:
            str = args[1];
            if (!str.isNil()) {
                str = str.convertToString();
                ((RubyString)str).modify();
            }
        case 1:
            if (!args[0].isNil()) {
                len = RubyNumeric.fix2int(args[0]);
View Full Code Here

            tmp = ((RubyArray)tmp).aryDup();
            //            RBASIC_CLEAR_CLASS(tmp);
            eargp = execargNew(context, ((RubyArray)tmp).toJavaArray(), false);
            ((RubyArray)tmp).clear();
        } else {
            pname = pname.convertToString();
            eargp = null;
            if (!isPopenFork(runtime, (RubyString)pname)) {
                IRubyObject[] pname_p = {pname};
                eargp = execargNew(context, pname_p, true);
                pname = pname_p[0];
View Full Code Here

            if (!val.isNil())
                val = StringSupport.checkEmbeddedNulls(runtime, val);

            key = key.convertToString().export(context);
            if (!val.isNil()) val = val.convertToString().export(context);

            env.push(runtime.newArray(key, val));
        }

        return env;
View Full Code Here

    protected boolean isConnectionValid(final ThreadContext context, final Connection connection) {
        if ( connection == null ) return false;
        final IRubyObject alive_sql = getConfigValue(context, "connection_alive_sql");
        Statement statement = null;
        try {
            RubyString aliveSQL = alive_sql.isNil() ? null : alive_sql.convertToString();
            if ( aliveSQL != null && isSelect(aliveSQL) ) {
                // expect a SELECT/CALL SQL statement
                statement = createStatement(context, connection);
                statement.execute( aliveSQL.toString() );
                return true; // connection alive
View Full Code Here

            Connection c = (Connection)recv.dataGetStruct();
            Statement stmt = null;
            try {
                stmt = c.createStatement();
                stmt.setMaxRows(maxrows);
                return unmarshal_result(recv, stmt.executeQuery(sql.convertToString().getUnicodeValue()));
            } catch(SQLException e) {
                if(c.isClosed()) {
                    recv = recv.callMethod(recv.getRuntime().getCurrentContext(),"reconnect!");
                    if(!((Connection)recv.dataGetStruct()).isClosed()) {
                        continue;
View Full Code Here

        DOMSource source = new DOMSource(doc.getDocument());

        IRubyObject uri = doc.url(context);
       
        if (!uri.isNil()) {
            source.setSystemId(uri.convertToString().asJavaString());
        }
       
        return getSchema(context, (RubyClass)klazz, source);
    }
   
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.