Examples of newString()


Examples of org.jruby.Ruby.newString()

                ix = s1.indexOf("..");
                first = s1.substring(0,ix);
                second = s1.substring(ix+2);
            }
            IRubyObject fist = runtime.fastGetModule("YAML").callMethod(context,"load",runtime.newString(first));
            IRubyObject sic = runtime.fastGetModule("YAML").callMethod(context,"load",runtime.newString(second));
            return RubyRange.newRange(runtime, context, fist, sic, exc);
        } else {
            final Map vars = (Map)(ctor.constructMapping(node));
            IRubyObject beg = (IRubyObject)vars.get(runtime.newString("begin"));
            IRubyObject end = (IRubyObject)vars.get(runtime.newString("end"));
View Full Code Here

Examples of org.jruby.Ruby.newString()

            IRubyObject fist = runtime.fastGetModule("YAML").callMethod(context,"load",runtime.newString(first));
            IRubyObject sic = runtime.fastGetModule("YAML").callMethod(context,"load",runtime.newString(second));
            return RubyRange.newRange(runtime, context, fist, sic, exc);
        } else {
            final Map vars = (Map)(ctor.constructMapping(node));
            IRubyObject beg = (IRubyObject)vars.get(runtime.newString("begin"));
            IRubyObject end = (IRubyObject)vars.get(runtime.newString("end"));
            boolean excl = ((IRubyObject)vars.get(runtime.newString("excl"))).isTrue();
            return RubyRange.newRange(runtime, context, beg, end, excl);
        }
    }
View Full Code Here

Examples of org.jruby.Ruby.newString()

            IRubyObject sic = runtime.fastGetModule("YAML").callMethod(context,"load",runtime.newString(second));
            return RubyRange.newRange(runtime, context, fist, sic, exc);
        } else {
            final Map vars = (Map)(ctor.constructMapping(node));
            IRubyObject beg = (IRubyObject)vars.get(runtime.newString("begin"));
            IRubyObject end = (IRubyObject)vars.get(runtime.newString("end"));
            boolean excl = ((IRubyObject)vars.get(runtime.newString("excl"))).isTrue();
            return RubyRange.newRange(runtime, context, beg, end, excl);
        }
    }
View Full Code Here

Examples of org.jruby.Ruby.newString()

            return RubyRange.newRange(runtime, context, fist, sic, exc);
        } else {
            final Map vars = (Map)(ctor.constructMapping(node));
            IRubyObject beg = (IRubyObject)vars.get(runtime.newString("begin"));
            IRubyObject end = (IRubyObject)vars.get(runtime.newString("end"));
            boolean excl = ((IRubyObject)vars.get(runtime.newString("excl"))).isTrue();
            return RubyRange.newRange(runtime, context, beg, end, excl);
        }
    }

    public static Object findAndCreateFromCustomTagging(final Constructor ctor, final Node node) {
View Full Code Here

Examples of org.jruby.Ruby.newString()

    }

    public static Object findAndCreateFromCustomTagging(final Constructor ctor, final Node node) {
        String tag = node.getTag();
        Ruby runtime = ((JRubyConstructor)ctor).runtime;
        IRubyObject _cl = runtime.fastGetModule("YAML").callMethod(runtime.getCurrentContext(), "tagged_classes").callMethod(runtime.getCurrentContext(),"[]", runtime.newString(tag));
        if(!(_cl instanceof RubyClass)) {
            return null;
        }
        RubyClass clazz = (RubyClass)_cl;
        if(clazz != null && !clazz.isNil()) {
View Full Code Here

Examples of org.jruby.Ruby.newString()

            List histList = holder.history.getHistoryList();

            // TODO: Not fully implemented. We just return the last value,
            // without really popping it.
            String current = (String)histList.get(histList.size() - 1);
            return runtime.newString(current);
        }

        @JRubyMethod(name = "to_a")
        public static IRubyObject s_hist_to_a(IRubyObject recv) throws Exception {
            ConsoleHolder holder = getHolder(recv.getRuntime());
View Full Code Here

Examples of org.jruby.Ruby.newString()

            ConsoleHolder holder = getHolder(runtime);
            int i = (int) index.convertToInteger().getLongValue();
            try {
                // TODO: MRI behavior is more complicated than that,
                // there is some magic when dealing with negative indexes.
                return runtime.newString((String) holder.history.getHistoryList().get(i));
            } catch (IndexOutOfBoundsException ioobe) {
                throw runtime.newIndexError("invalid history index: " + i);
            }
        }
View Full Code Here

Examples of org.jruby.Ruby.newString()

    }

    private static RubyModule createPackageModule(RubyModule parent, String name, String packageString) {
        Ruby runtime = parent.getRuntime();
        RubyModule packageModule = (RubyModule) runtime.getJavaSupport().getPackageModuleTemplate().dup();
        packageModule.fastSetInstanceVariable("@package_name", runtime.newString(
                packageString.length() > 0 ? packageString + '.' : packageString));

        // this is where we'll get connected when classes are opened using
        // package module syntax.
        packageModule.addClassProvider(JAVA_PACKAGE_CLASS_PROVIDER);
View Full Code Here

Examples of org.jruby.Ruby.newString()

        if (!(byteArray instanceof JavaArray &&
                ((JavaArray)byteArray).getValue() instanceof byte[])) {
            throw runtime.newTypeError("wrong argument type " + wrappedObject.getMetaClass() +
                    " (expected byte[])");
        }
        return runtime.newString(new ByteList((byte[])((JavaArray)byteArray).getValue(), true));
    }
   
    @JRubyMethod(module = true, visibility = Visibility.PRIVATE)
    public static IRubyObject ruby_string_to_bytes(IRubyObject recv, IRubyObject string) {
        Ruby runtime = recv.getRuntime();
View Full Code Here

Examples of org.jruby.Ruby.newString()

        configModule.defineConstant("MAKEFILE_CONFIG", mkmfHash);
    }

    private static void setConfig(RubyHash mkmfHash, String key, String value) {
        Ruby runtime = mkmfHash.getRuntime();
        mkmfHash.op_aset(runtime.getCurrentContext(), runtime.newString(key), runtime.newString(value));
    }

    public static String jrubyScript() {
        return System.getProperty("jruby.script", Platform.IS_WINDOWS ? "jruby.bat" : "jruby").replace('\\', '/');
    }
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.