Examples of IAccessor


Examples of org.jruby.runtime.IAccessor

            argvArray.append(RubyString.newString(runtime, argv[i].getBytes()));
        }
        runtime.defineGlobalConstant("ARGV", argvArray);
        runtime.getGlobalVariables().defineReadonly("$*", new ValueAccessor(argvArray));

        IAccessor d = new ValueAccessor(runtime.newString(
                runtime.getInstanceConfig().displayedFileName()));
        runtime.getGlobalVariables().define("$PROGRAM_NAME", d);
        runtime.getGlobalVariables().define("$0", d);

        // Version information:
View Full Code Here

Examples of org.jruby.runtime.IAccessor

     * @param inputStream The InputStream from which to read the script contents
     * @param filename The filename to use when parsing, and for $PROGRAM_NAME
     * and $0 ruby global variables.
     */
    public void runFromMain(InputStream inputStream, String filename) {
        IAccessor d = new ValueAccessor(newString(filename));
        getGlobalVariables().define("$PROGRAM_NAME", d);
        getGlobalVariables().define("$0", d);

        for (Iterator i = config.getOptionGlobals().entrySet().iterator(); i.hasNext();) {
            Map.Entry entry = (Map.Entry) i.next();
View Full Code Here

Examples of org.jruby.runtime.IAccessor

    }

    /** Defines a global variable
     */
    public void defineVariable(final GlobalVariable variable) {
        globalVariables.define(variable.name(), new IAccessor() {
            public IRubyObject getValue() {
                return variable.get();
            }

            public IRubyObject setValue(IRubyObject newValue) {
View Full Code Here

Examples of org.jruby.runtime.IAccessor

        RubyObject argsFile = new RubyObject(runtime, runtime.getObject());

        runtime.getEnumerable().extend_object(argsFile);

        runtime.setArgsFile(argsFile);
        runtime.getGlobalVariables().defineReadonly("$<", new IAccessor() {
            public IRubyObject getValue() {
                return runtime.getArgsFile();
            }

            public IRubyObject setValue(IRubyObject newValue) {
View Full Code Here

Examples of org.jruby.runtime.IAccessor

        }
        if (filename == null || filename.length() == 0) {
            filename = container.getScriptFilename();
        }
        Ruby runtime = container.getProvider().getRuntime();
        IAccessor d = new ValueAccessor(RubyString.newString(runtime, filename));
        runtime.getGlobalVariables().define("$PROGRAM_NAME", d);
        runtime.getGlobalVariables().define("$0", d);

        int line = 0;
        if (lines != null && lines.length > 0) {
View Full Code Here

Examples of org.jruby.runtime.IAccessor

            argvArray.append(RubyString.newStringShared(runtime, argv[i].getBytes()));
        }
        runtime.defineGlobalConstant("ARGV", argvArray);
        runtime.getGlobalVariables().defineReadonly("$*", new ValueAccessor(argvArray));

        IAccessor d = new ValueAccessor(runtime.newString(
                runtime.getInstanceConfig().displayedFileName()));
        runtime.getGlobalVariables().define("$PROGRAM_NAME", d);
        runtime.getGlobalVariables().define("$0", d);

        // Version information:
View Full Code Here

Examples of org.jruby.runtime.IAccessor

     * @param inputStream The InputStream from which to read the script contents
     * @param filename The filename to use when parsing, and for $PROGRAM_NAME
     * and $0 ruby global variables.
     */
    public void runFromMain(InputStream inputStream, String filename) {
        IAccessor d = new ValueAccessor(newString(filename));
        getGlobalVariables().define("$PROGRAM_NAME", d);
        getGlobalVariables().define("$0", d);

        for (Iterator i = config.getOptionGlobals().entrySet().iterator(); i.hasNext();) {
            Map.Entry entry = (Map.Entry) i.next();
View Full Code Here

Examples of org.jruby.runtime.IAccessor

    }

    /** Defines a global variable
     */
    public void defineVariable(final GlobalVariable variable) {
        globalVariables.define(variable.name(), new IAccessor() {
            public IRubyObject getValue() {
                return variable.get();
            }

            public IRubyObject setValue(IRubyObject newValue) {
View Full Code Here

Examples of org.jruby.runtime.IAccessor

    private void init(final String loadPath) {
        AccessController.doPrivileged(new PrivilegedAction<Object>() {
            public Object run() {
                runtime = Ruby.newInstance();
                IAccessor d = new ValueAccessor(runtime.newString("<script>"));
                runtime.getGlobalVariables().define("$PROGRAM_NAME", d);
                runtime.getGlobalVariables().define("$0", d);
                String path = loadPath;
                if (path == null) {
                    path = System.getProperty("java.class.path");
View Full Code Here

Examples of org.jruby.runtime.IAccessor

        }
        if (filename == null || filename.length() == 0) {
            filename = container.getScriptFilename();
        }
        Ruby runtime = container.getProvider().getRuntime();
        IAccessor d = new ValueAccessor(RubyString.newString(runtime, filename));
        runtime.getGlobalVariables().define("$PROGRAM_NAME", d);
        runtime.getGlobalVariables().define("$0", d);

        int line = 0;
        if (lines != null && lines.length > 0) {
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.