Package org.jruby

Examples of org.jruby.RubyString.callMethod()


        // quoted = string.gsub("'", "''")
        RubyString quoted = quoteCharWith(context, str, '\'', '\'');

        if ( ! standard_conforming_strings(context, self) ) { // minor branch
            // quoted.gsub!(/\\/, '\&\&')
            return quoted.callMethod(context, "gsub", new IRubyObject[] {
                context.runtime.newString(BYTES_BACKSLASH),
                context.runtime.newString(BYTES_ANDAND)
            });
        }
        return quoted;
View Full Code Here


            RubyString svalue = RubyString.objAsString(value);
            if(type == runtime.newSymbol("binary") && col.getType().respondsTo("string_to_binary")) {
                return quote_string_with_surround(runtime, "'", (RubyString)(col.getType().callMethod(runtime.getCurrentContext(), "string_to_binary", svalue)), "'");
            } else if(type == runtime.newSymbol("integer") || type == runtime.newSymbol("float")) {
                return RubyString.objAsString(((type == runtime.newSymbol("integer")) ?
                                               svalue.callMethod(runtime.getCurrentContext(), "to_i") :
                                               svalue.callMethod(runtime.getCurrentContext(), "to_f")));
            } else {
                return quote_string_with_surround(runtime, "'", svalue, "'");
            }
        } else if(value.isNil()) {
View Full Code Here

            if(type == runtime.newSymbol("binary") && col.getType().respondsTo("string_to_binary")) {
                return quote_string_with_surround(runtime, "'", (RubyString)(col.getType().callMethod(runtime.getCurrentContext(), "string_to_binary", svalue)), "'");
            } else if(type == runtime.newSymbol("integer") || type == runtime.newSymbol("float")) {
                return RubyString.objAsString(((type == runtime.newSymbol("integer")) ?
                                               svalue.callMethod(runtime.getCurrentContext(), "to_i") :
                                               svalue.callMethod(runtime.getCurrentContext(), "to_f")));
            } else {
                return quote_string_with_surround(runtime, "'", svalue, "'");
            }
        } else if(value.isNil()) {
            return runtime.newStringShared(NULL);
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.