Package org.jruby

Examples of org.jruby.RubyHash.op_aset()


        result.op_aset(context, runtime.newSymbol("array_nl"), array_nl_get(context));
        result.op_aset(context, runtime.newSymbol("allow_nan"), allow_nan_p(context));
        result.op_aset(context, runtime.newSymbol("ascii_only"), ascii_only_p(context));
        result.op_aset(context, runtime.newSymbol("quirks_mode"), quirks_mode_p(context));
        result.op_aset(context, runtime.newSymbol("max_nesting"), max_nesting_get(context));
        result.op_aset(context, runtime.newSymbol("depth"), depth_get(context));
        result.op_aset(context, runtime.newSymbol("buffer_initial_length"), buffer_initial_length_get(context));
        for (String name: getInstanceVariableNameList()) {
            result.op_aset(context, runtime.newSymbol(name.substring(1)), getInstanceVariables().getInstanceVariable(name));
        }
        return result;
View Full Code Here


        result.op_aset(context, runtime.newSymbol("allow_nan"), allow_nan_p(context));
        result.op_aset(context, runtime.newSymbol("ascii_only"), ascii_only_p(context));
        result.op_aset(context, runtime.newSymbol("quirks_mode"), quirks_mode_p(context));
        result.op_aset(context, runtime.newSymbol("max_nesting"), max_nesting_get(context));
        result.op_aset(context, runtime.newSymbol("depth"), depth_get(context));
        result.op_aset(context, runtime.newSymbol("buffer_initial_length"), buffer_initial_length_get(context));
        for (String name: getInstanceVariableNameList()) {
            result.op_aset(context, runtime.newSymbol(name.substring(1)), getInstanceVariables().getInstanceVariable(name));
        }
        return result;
    }
View Full Code Here

        result.op_aset(context, runtime.newSymbol("quirks_mode"), quirks_mode_p(context));
        result.op_aset(context, runtime.newSymbol("max_nesting"), max_nesting_get(context));
        result.op_aset(context, runtime.newSymbol("depth"), depth_get(context));
        result.op_aset(context, runtime.newSymbol("buffer_initial_length"), buffer_initial_length_get(context));
        for (String name: getInstanceVariableNameList()) {
            result.op_aset(context, runtime.newSymbol(name.substring(1)), getInstanceVariables().getInstanceVariable(name));
        }
        return result;
    }

    public int increaseDepth() {
View Full Code Here

    public void testUsesRubyEnvPathToRunShellPrograms() {
        RubyHash env = (RubyHash) runtime.getObject().getConstant("ENV");
        RubyString path = runtime.newString("PATH");
        RubyString utilPath = runtime.newString(System.getProperty("jruby.home") + "/core/src/test/java/org/jruby/util");
        ThreadContext context = runtime.getCurrentContext();
        env.op_aset(context, path,
                env.op_aref(context, path).convertToString()
                .op_plus(context, runtime.newString(File.pathSeparator)).convertToString()
                .op_plus(context, utilPath));

        String cmd = "shell_launcher_test";
View Full Code Here

    @JRubyMethod(module = true)
    public static IRubyObject uname(ThreadContext context, IRubyObject self) {
        Ruby runtime = context.runtime;
        RubyHash uname = RubyHash.newHash(runtime);

        uname.op_aset(context,
                runtime.newSymbol("sysname"),
                runtime.newString(SafePropertyAccessor.getProperty("os.name", "unknown")));
        try {
            uname.op_aset(context,
                    runtime.newSymbol("nodename"),
View Full Code Here

        uname.op_aset(context,
                runtime.newSymbol("sysname"),
                runtime.newString(SafePropertyAccessor.getProperty("os.name", "unknown")));
        try {
            uname.op_aset(context,
                    runtime.newSymbol("nodename"),
                    runtime.newString(InetAddress.getLocalHost().getHostName()));
        } catch (UnknownHostException uhe) {
            uname.op_aset(context,
                    runtime.newSymbol("nodename"),
View Full Code Here

        try {
            uname.op_aset(context,
                    runtime.newSymbol("nodename"),
                    runtime.newString(InetAddress.getLocalHost().getHostName()));
        } catch (UnknownHostException uhe) {
            uname.op_aset(context,
                    runtime.newSymbol("nodename"),
                    runtime.newString("unknown"));
        }
        uname.put(runtime.newSymbol("release"), runtime.newString("unknown"));
        uname.put(runtime.newSymbol("version"), runtime.newString(SafePropertyAccessor.getProperty("os.version")));
View Full Code Here

                RubyHash options = (RubyHash)opts;
                IRubyObject optsMode = options.delete(context, runtime.newSymbol("mode"), Block.NULL_BLOCK);
                if (!optsMode.isNil()) {
                    mode |= optsMode.convertToInteger().getIntValue();
                }
                options.op_aset(context, runtime.newSymbol("perm"), perm);
            } else {
                opts = perm;
            }

            try {
View Full Code Here

            RubyHash hash = new RubyHash(getRuntime());
            Set<Map.Entry> entries = ((Map) ((JavaProxy)receiver).getObject()).entrySet();
            for (Map.Entry entry : entries) {
                IRubyObject key = JavaUtil.convertJavaToUsableRubyObject(getRuntime(), entry.getKey());
                IRubyObject value = JavaUtil.convertJavaToUsableRubyObject(getRuntime(), entry.getValue());
                hash.op_aset(getRuntime().getCurrentContext(), key, value);
            }
            return hash;
        }
    }
View Full Code Here

                        throw runtime.newArgumentError("wrong exec option symbol: " + key);
                    throw runtime.newArgumentError("wrong exec option");
                }

                if (nonopts == null) nonopts = RubyHash.newHash(runtime);
                nonopts.op_aset(context, key, val);
            }
        }
        return nonopts != null ? nonopts : context.nil;
    }
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.