Package org.jruby

Examples of org.jruby.RubyInstanceConfig$Argument


            jitIsEnabled(method, context, name);
        }
    }
   
    private void jitIsEnabled(final DefaultMethod method, final ThreadContext context, final String name) {
        RubyInstanceConfig instanceConfig = ruby.get().getInstanceConfig();
        int callCount = method.incrementCallCount();
       
        if (callCount >= instanceConfig.getJitThreshold()) {
            jitThresholdReached(method, instanceConfig, context, name);
        }
    }
View Full Code Here


            }
            return m;
        }

        public void start() throws IOException {
            this.config = new RubyInstanceConfig() {{
                setEnvironment(environmentMap(env));
                setCurrentDirectory(pwd.toString());
            }};
            if (pipedStreams) {
                this.config.setInput(new PipedInputStream(processInput));
View Full Code Here

     *
     * @param loadPaths to specify where to look for Ruby modules.
     * @return an instance
     */
    public static Ruby initialize(List loadPaths) {
        return initialize(loadPaths, new RubyInstanceConfig());
    }
View Full Code Here

     * @param loadPaths to specify where to look for Ruby modules.
     * @param classCache to use as a common repository for cached classes
     * @return an instance
     */
    public static Ruby initialize(List loadPaths, ClassCache classCache) {
        RubyInstanceConfig config = new RubyInstanceConfig();
        if (classCache != null) {
            config.setClassCache(classCache);
        }
        return initialize(loadPaths, config);
    }
View Full Code Here

     *
     * @param loader use the provided classloader to create the cache
     * @return
     */
    public static ClassCache createClassCache(ClassLoader loader) {
        return new ClassCache(loader, new RubyInstanceConfig().getJitMax());
    }
View Full Code Here

  public static void debuggery(String message) {
    System.err.println("DEBUGGERY:" + message); // JGBDEBUG
  }

  public static void main(String[] args) throws Exception {  
    RubyInstanceConfig config = new RubyInstanceConfig();
    config.setArgv(args);
    Ruby runtime = JavaEmbedUtils.initialize(new ArrayList(0), config);
    String mainRubyFile  = "main";
    String runConfigFile = "run_configuration";

    ArrayList<String> config_data = new ArrayList<String>();
View Full Code Here

            // expected
        }

        // change the thread context to include the class
        SimpleClassLoader simpleLoader = new SimpleClassLoader();
        RubyInstanceConfig config = new RubyInstanceConfig();
        config.setLoader(simpleLoader);
        ruby = Ruby.newInstance(config);

        try {
            ruby.getJRubyClassLoader().loadClass("org.jruby.GiveMeAString");
        } catch (ClassNotFoundException e) {
View Full Code Here

     */
    public void testRedefineClassPerRuntime() throws Exception {
        ClassLoader v1 = new VersionedClassLoader("First");
        ClassLoader v2 = new VersionedClassLoader("Second");

        RubyInstanceConfig config1 = new RubyInstanceConfig();
        config1.setLoader(v1);
        RubyInstanceConfig config2 = new RubyInstanceConfig();
        config2.setLoader(v2);
        Ruby ruby1 = Ruby.newInstance(config1);
        Ruby ruby2 = Ruby.newInstance(config2);

        assertEquals("First", getMessage(ruby1));
        assertEquals("Second", getMessage(ruby2));
View Full Code Here

            public void windowClosing(WindowEvent e) {
                tar.shutdown();
            }
        });

        final RubyInstanceConfig config = new RubyInstanceConfig() {{
            setInput(tar.getInputStream());
            setOutput(new PrintStream(tar.getOutputStream()));
            setError(new PrintStream(tar.getOutputStream()));
            setObjectSpaceEnabled(true); // useful for code completion inside the IRB
            setArgv(args);
View Full Code Here

        }
    }
   
    public void testPrintErrorShouldPrintErrorMessageAndStacktraceWhenBacktraceIsPresent() {
        final ByteArrayOutputStream err = new ByteArrayOutputStream();
        RubyInstanceConfig config = new RubyInstanceConfig() {{
            setInput(System.in); setOutput(System.out); setError(new PrintStream(err)); setObjectSpaceEnabled(false);
        }};
        Ruby ruby = Ruby.newInstance(config);
        RubyException exception = (RubyException)runtime.getClass("NameError").newInstance(ruby.getCurrentContext(), new IRubyObject[]{ruby.newString("A message")},  Block.NULL_BLOCK);
        RubyString[] lines = new RubyString[]{
View Full Code Here

TOP

Related Classes of org.jruby.RubyInstanceConfig$Argument

Copyright © 2018 www.massapicom. 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.