Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
BEGIN LICENSE BLOCK ***** Version: EPL 1.0/GPL 2.0/LGPL 2.1 The contents of this file are subject to the Eclipse Public License Version 1.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.eclipse.org/legal/epl-v10.html Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. Copyright (C) 2007-2011 Nick Sieger <nicksieger@gmail.com> Copyright (C) 2009 Joseph LaFata <joe@quibb.org> Alternatively, the contents of this file may be used under the terms of either of the GNU General Public License Version 2 or later (the "GPL"), or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), in which case the provisions of the GPL or the LGPL are applicable instead of those above. If you wish to allow use of your version of this file only under the terms of either the GPL or the LGPL, and not to allow others to use your version of this file under the terms of the EPL, indicate your decision by deleting the provisions above and replace them with the notice and other provisions required by the GPL or the LGPL. If you do not delete the provisions above, a recipient may use your version of this file under the terms of any one of the EPL, the GPL or the LGPL. END LICENSE BLOCK ***
  
  package org.jruby;
  
  import java.io.File;
  import java.net.URL;
  import java.util.Arrays;
  import java.util.HashMap;
  import java.util.HashSet;
  import java.util.List;
  import java.util.Map;
  import java.util.Set;
  
  import  org.objectweb.asm.Opcodes;

A structure used to configure new JRuby instances. All publicly-tweakable aspects of Ruby can be modified here, including those settable by command- line options, those available through JVM properties, and those suitable for embedding.
  
  public class RubyInstanceConfig {
      public RubyInstanceConfig() {
           = Ruby.isSecurityRestricted() ? "/" : JRubyFile.getFileProperty("user.dir");
  
          String compatString = ..load();
           = CompatVersion.getVersionFromString(compatString);
          if ( == null) {
              .println("Compatibility version `" + compatString + "' invalid; use 1.8, 1.9, or 2.0. Using 1.8.");
               = .;
          }
  
          if (Ruby.isSecurityRestricted()) {
               = .;
               = false;
               = false;
               = false;
               = 0;
               = -1;
              = 0;
              = -1;
              = false;
         } else {
             if ( != null) {
                 String[] elements = .split(",");
                 .addAll(Arrays.asList(elements));
             }
             
              = ..load();
              = ..load();
             
             String jitModeProperty = ..load();
 
             if (jitModeProperty.equals("OFF")) {
                  = .;
             } else if (jitModeProperty.equals("OFFIR")) {
                  = .;
             } else if (jitModeProperty.equals("JIT")) {
                  = .;
             } else if (jitModeProperty.equals("FORCE")) {
                  = .;
             } else {
                 .print(. + " property must be OFF, JIT, FORCE, or unset; defaulting to JIT");
                  = .;
             }
             
              = ..load();
              = ..load();
              = ..load();
              = ..load();
              = ..load();
              = ..load();
              = ..load();
         }
 
         // default ClassCache using jitMax as a soft upper bound
          = new ClassCache<Script>();
         
         try {
              = System.getenv();
         } catch (SecurityException se) {
              = new HashMap();
         }
     }
     
     public RubyInstanceConfig(RubyInstanceConfig parentConfig) {
          = parentConfig.getCurrentDirectory();
          = parentConfig.compatVersion;
          = parentConfig.getCompileMode();
          = parentConfig.jitLogging;
          = parentConfig.jitDumping;
          = parentConfig.jitLoggingVerbose;
          = parentConfig.jitLogEvery;
          = parentConfig.jitThreshold;
          = parentConfig.jitMax;
          = parentConfig.jitMaxSize;
          = parentConfig.managementEnabled;
          = parentConfig.runRubyInProcess;
          = parentConfig.excludedMethods;
          = parentConfig.threadDumpSignal;
          = parentConfig.updateNativeENVEnabled;
         
          = new ClassCache<Script>();
 
         try {
              = System.getenv();
         } catch (SecurityException se) {
              = new HashMap();
         }
     }
     
     public RubyInstanceConfig(final InputStream infinal PrintStream outfinal PrintStream err) {
         this();
         setInput(in);
         setOutput(out);
         setError(err);
     }
 
     public LoadService createLoadService(Ruby runtime) {
         return .create(runtime);
     }
 
     public void processArguments(String[] arguments) {
         new ArgumentProcessor(argumentsthis).processArguments();
     }
 
     public void tryProcessArgumentsWithRubyopts() {
         try {
             // environment defaults to System.getenv normally
             Object rubyoptObj = .get("RUBYOPT");
             String rubyopt = rubyoptObj == null ? null : rubyoptObj.toString();
             
             if (rubyopt == null || "".equals(rubyopt)) return;
 
             if (rubyopt.split("\\s").length != 0) {
                 String[] rubyoptArgs = rubyopt.split("\\s+");
                 new ArgumentProcessor(rubyoptArgsfalsetruethis).processArguments();
             }
         } catch (SecurityException se) {
             // ignore and do nothing
         }
     }
     
     // This method does not work like previous version in verifying it is
     // a Ruby shebang line.  Looking for ruby before \n is possible to add,
     // but I wanted to keep this short.
     private boolean isShebang(InputStreamMarkCursor cursorthrows IOException {
         if (cursor.read() == '#') {
             int c = cursor.read();
             if (c == '!') {
                 cursor.endPoint(-2);
                 return true;
             } else if (c == '\n') {
                 cursor.rewind();
             }
         } else {
             cursor.rewind();
         }
         
         return false;
     }
     
     private boolean skipToNextLine(InputStreamMarkCursor cursorthrows IOException {
         int c = cursor.read();
         do {
             if (c == '\n'return true;
         } while ((c = cursor.read()) != -1);
         
         return false;
     }
 
     private void eatToShebang(InputStream in) {
         InputStreamMarkCursor cursor = new InputStreamMarkCursor(in, 8192);
         try {
             do {
                 if (isShebang(cursor)) break;
             } while (skipToNextLine(cursor));
         } catch (IOException e) {
         } finally {
             try { cursor.finish(); } catch (IOException e) {}
         }
     }
    
    
The intent here is to gather up any options that might have been specified in the shebang line and return them so they can be merged into the ones specified on the command-line. This is kind of a hopeless task because it's impossible to figure out where the command invocation stops and the parameters start. We try to work with the common scenarios where /usr/bin/env is used to invoke the JRuby shell script, and skip any parameters it might have. Then we look for the interpreter invocation and assume that the binary will have the word "ruby" in the name. This is error prone but should cover more cases than the previous code.
 
     public String[] parseShebangOptions(InputStream in) {
         BufferedReader reader = null;
         String[] result = new String[0];
         if (in == nullreturn result;
         
         if (isXFlag()) eatToShebang(in);
         
         try {
             InputStreamMarkCursor cursor = new InputStreamMarkCursor(in, 8192);
             try {
                 if (!isShebang(cursor)) return result;
             } finally {
                 cursor.finish();
             }
 
             in.mark(8192);
             reader = new BufferedReader(new InputStreamReader(in"iso-8859-1"), 8192);
             String firstLine = reader.readLine();
 
             boolean usesEnv = false;
             if (firstLine.length() > 2 && firstLine.charAt(0) == '#' && firstLine.charAt(1) == '!') {
                 String[] options = firstLine.substring(2).split("\\s+");
                 int i;
                 for (i = 0; i < options.lengthi++) {
                     // Skip /usr/bin/env if it's first
                     if (i == 0 && options[i].endsWith("/env")) {
                         usesEnv = true;
                         continue;
                     }
                     // Skip any assignments if /usr/bin/env is in play
                     if (usesEnv && options[i].indexOf('=') > 0) continue;
 
                     // Skip any commandline args if /usr/bin/env is in play
                     if (usesEnv && options[i].startsWith("-")) continue;
 
                     String basename = (new File(options[i])).getName();
                     if (basename.indexOf("ruby") > 0) break;
                 }
                 setHasShebangLine(true);
                 System.arraycopy(optionsiresult, 0, options.length - i);
             } else {
                 // No shebang line found
                 setHasShebangLine(false);
             }
         } catch (Exception ex) {
             // ignore error
         } finally {
             try {
                 in.reset();
             } catch (IOException ex) {}
         }
         return result;
     }
     
     private static final Pattern RUBY_SHEBANG = Pattern.compile("#!.*ruby.*");
 
     protected static boolean isRubyShebangLine(String line) {
         return .matcher(line).matches();
     }
     
     private String calculateJRubyHome() {
         String newJRubyHome = null;
         
         // try the normal property first
         if (!Ruby.isSecurityRestricted()) {
             newJRubyHome = SafePropertyAccessor.getProperty("jruby.home");
         }
 
         if (newJRubyHome != null) {
             // verify it if it's there
             newJRubyHome = verifyHome(newJRubyHome);
         } else {
             try {
                 newJRubyHome = SystemPropertyCatcher.findFromJar(this);
             } catch (Exception e) {}
 
             if (newJRubyHome != null) {
                 // verify it if it's there
                 newJRubyHome = verifyHome(newJRubyHome);
             } else {
                 // otherwise fall back on system temp location
                 newJRubyHome = SafePropertyAccessor.getProperty("java.io.tmpdir");
             }
         }
         
         return newJRubyHome;
     }
 
     // We require the home directory to be absolute
     private static String verifyHome(String homePrintStream error) {
         if (home.equals(".")) {
             home = SafePropertyAccessor.getProperty("user.dir");
         }
         if (home.startsWith("cp:")) {
             home = home.substring(3);
         } else if (!home.startsWith("file:") && !home.startsWith("classpath:")) {
             NormalizedFile f = new NormalizedFile(home);
             if (!f.isAbsolute()) {
                 home = f.getAbsolutePath();
             }
             if (!f.exists()) {
                 error.println("Warning: JRuby home \"" + f + "\" does not exist, using " + SafePropertyAccessor.getProperty("java.io.tmpdir"));
                 return System.getProperty("java.io.tmpdir");
             }
         }
         return home;
     }

    
Indicates whether the JVM process' native environment will be updated when ENV[...] is set from Ruby.
 
     public boolean isUpdateNativeENVEnabled() {
         return ;
     }

    
Ensure that the JVM process' native environment will be updated when ENV is modified
 
     public void setUpdateNativeENVEnabled(boolean updateNativeENVEnabled) {
         this. = updateNativeENVEnabled;
     }
 
     public byte[] inlineScript() {
         return .toString().getBytes();
     }
 
     public InputStream getScriptSource() {
         try {
             // KCode.NONE is used because KCODE does not affect parse in Ruby 1.8
             // if Ruby 2.0 encoding pragmas are implemented, this will need to change
             if () {
                 return new ByteArrayInputStream(inlineScript());
             } else if (isSourceFromStdin()) {
                 // can't use -v and stdin
                 if (isShowVersion()) {
                     return null;
                 }
                 return getInput();
             } else {
                 String script = getScriptFileName();
                 InputStream stream = null;
                 if (script.startsWith("file:") && script.indexOf(".jar!/") != -1) {
                     stream = new URL("jar:" + script).openStream();
                 } else if (script.startsWith("classpath:")) {
                     stream = Ruby.getClassLoader().getResourceAsStream(script.substring("classpath:".length()));
                 } else {
                     File file = JRubyFile.create(getCurrentDirectory(), getScriptFileName());
                     if (isXFlag()) {
                         // search for a shebang line and
                         // return the script between shebang and __END__ or CTRL-Z (0x1A)
                         return findScript(file);
                     }
                     stream = new FileInputStream(file);
                 }
 
                 return new BufferedInputStream(stream, 8192);
             }
         } catch (IOException e) {
             // We haven't found any file directly on the file system,
             // now check for files inside the JARs.
             InputStream is = getJarScriptSource();
             if (is != null) {
                 return new BufferedInputStream(is, 8129);
             }
             throw new MainExitException(1, "Error opening script file: " + e.getMessage());
         }
     }
 
     private static InputStream findScript(File filethrows IOException {
         StringBuffer buf = new StringBuffer();
         BufferedReader br = new BufferedReader(new FileReader(file));
         String currentLine = br.readLine();
         while (currentLine != null && !isRubyShebangLine(currentLine)) {
             currentLine = br.readLine();
         }
 
         buf.append(currentLine);
         buf.append("\n");
 
         do {
             currentLine = br.readLine();
             if (currentLine != null) {
             buf.append(currentLine);
             buf.append("\n");
             }
         } while (!(currentLine == null || currentLine.contains("__END__") || currentLine.contains("\026")));
         return new BufferedInputStream(new ByteArrayInputStream(buf.toString().getBytes()), 8192);
     }
 
     private static InputStream getJarScriptSource(String scriptFileName) {
         boolean looksLikeJarURL = scriptFileName.startsWith("file:") && scriptFileName.indexOf("!/") != -1;
         if (!looksLikeJarURL) {
             return null;
         }
 
         String before = scriptFileName.substring("file:".length(), scriptFileName.indexOf("!/"));
         String after =  scriptFileName.substring(scriptFileName.indexOf("!/") + 2);
 
         try {
             JarFile jFile = new JarFile(before);
             JarEntry entry = jFile.getJarEntry(after);
 
             if (entry != null && !entry.isDirectory()) {
                 return jFile.getInputStream(entry);
             }
         } catch (IOException ignored) {
         }
         return null;
     }
 
     public String displayedFileName() {
         if () {
             if ( != null) {
                 return ;
             } else {
                 return "-e";
             }
         } else if (isSourceFromStdin()) {
             return "-";
         } else {
             return getScriptFileName();
         }
     }
 
     public ASTCompiler newCompiler() {
         if (getCompatVersion() == .) {
             return new ASTCompiler();
         } else {
             return new ASTCompiler19();
         }
     }
     
     ////////////////////////////////////////////////////////////////////////////
     // Static utilities and global state management methods.
     ////////////////////////////////////////////////////////////////////////////
     
     public static boolean hasLoadedNativeExtensions() {
         return ;
     }
     
     public static void setLoadedNativeExtensions(boolean loadedNativeExtensions) {
         . = loadedNativeExtensions;
     }
     
     ////////////////////////////////////////////////////////////////////////////
     // Getters and setters for config settings.
     ////////////////////////////////////////////////////////////////////////////
 
         return ;
     }
 
     public void setLoadServiceCreator(LoadServiceCreator creator) {
         this. = creator;
     }
 
     public String getJRubyHome() {
         if ( == null) {
              = calculateJRubyHome();
         }
         return ;
     }
 
     public void setJRubyHome(String home) {
          = verifyHome(home);
     }
 
     public CompileMode getCompileMode() {
         return ;
     }
 
     public void setCompileMode(CompileMode compileMode) {
         this. = compileMode;
     }

    

See also:
Options.JIT_LOGGING
 
     public boolean isJitLogging() {
         return ;
     }

    

See also:
Options.JIT_DUMPING
 
     public boolean isJitDumping() {
         return ;
     }

    

See also:
Options.JIT_LOGGING_VERBOSE
 
     public boolean isJitLoggingVerbose() {
         return ;
     }

    

See also:
Options.JIT_LOGEVERY
 
     public int getJitLogEvery() {
         return ;
     }

    

See also:
Options.JIT_LOGEVERY
 
     public void setJitLogEvery(int jitLogEvery) {
         this. = jitLogEvery;
     }

    

See also:
Options.JIT_THRESHOLD
 
     public int getJitThreshold() {
         return ;
     }

    

See also:
Options.JIT_THRESHOLD
 
     public void setJitThreshold(int jitThreshold) {
         this. = jitThreshold;
     }

    

See also:
Options.JIT_MAX
 
     public int getJitMax() {
         return ;
     }

    

See also:
Options.JIT_MAX
 
     public void setJitMax(int jitMax) {
         this. = jitMax;
     }

    

See also:
Options.JIT_MAXSIZE
 
     public int getJitMaxSize() {
         return ;
     }

    

See also:
Options.JIT_MAXSIZE
 
     public void setJitMaxSize(int jitMaxSize) {
         this. = jitMaxSize;
     }

    

See also:
Options.LAUNCH_INPROC
 
     public boolean isRunRubyInProcess() {
         return ;
     }

    

See also:
Options.LAUNCH_INPROC
 
     public void setRunRubyInProcess(boolean flag) {
         this. = flag;
     }
 
     public void setInput(InputStream newInput) {
          = newInput;
     }
 
     public InputStream getInput() {
         return ;
     }

    

See also:
Options.COMPAT_VERSION
 
     public CompatVersion getCompatVersion() {
         return ;
     }

    

See also:
Options.COMPAT_VERSION
 
     public void setCompatVersion(CompatVersion compatVersion) {
         if (compatVersion == nullcompatVersion = .;
 
         this. = compatVersion;
     }
 
     public void setOutput(PrintStream newOutput) {
          = newOutput;
     }
 
     public PrintStream getOutput() {
         return ;
     }
 
     public void setError(PrintStream newError) {
          = newError;
     }
 
     public PrintStream getError() {
         return ;
     }
 
     public void setCurrentDirectory(String newCurrentDirectory) {
          = newCurrentDirectory;
     }
 
     public String getCurrentDirectory() {
         return ;
     }
 
     public void setProfile(Profile newProfile) {
          = newProfile;
     }
 
     public Profile getProfile() {
         return ;
     }

    

See also:
Options.OBJECTSPACE_ENABLED
 
     public void setObjectSpaceEnabled(boolean newObjectSpaceEnabled) {
          = newObjectSpaceEnabled;
     }

    

See also:
Options.OBJECTSPACE_ENABLED
 
     public boolean isObjectSpaceEnabled() {
         return ;
     }
    
    

See also:
Options.SIPHASH_ENABLED
 
     public void setSiphashEnabled(boolean newSiphashEnabled) {
          = newSiphashEnabled;
     }
    
    

See also:
Options.SIPHASH_ENABLED
 
     public boolean isSiphashEnabled() {
         return ;
     }
 
     public void setEnvironment(Map newEnvironment) {
         if (newEnvironment == nullnewEnvironment = new HashMap();
          = newEnvironment;
     }
 
     public Map getEnvironment() {
         return ;
     }
 
     public ClassLoader getLoader() {
         return ;
     }
 
     public void setLoader(ClassLoader loader) {
         // Setting the loader needs to reset the class cache
         if(this. != loader) {
             this. = new ClassCache<Script>(loaderthis..getMax());
         }
         this. = loader;
     }
 
     public String[] getArgv() {
         return ;
     }
 
     public void setArgv(String[] argv) {
         this. = argv;
     }
     
     public StringBuffer getInlineScript() {
         return ;
     }
     
     public void setHasInlineScript(boolean hasInlineScript) {
         this. = true;
         this. = hasInlineScript;
     }
     
     public boolean hasInlineScript() {
         return ;
     }
     
     public Collection<StringgetRequiredLibraries() {
         return ;
     }
     
     public List<StringgetLoadPaths() {
         return ;
     }
 
     public void setLoadPaths(List<StringloadPaths) {
         this. = loadPaths;
     }
    
    

See also:
Options.CLI_HELP
 
     public void setShouldPrintUsage(boolean shouldPrintUsage) {
         this. = shouldPrintUsage;
     }
    
    

See also:
Options.CLI_HELP
 
     public boolean getShouldPrintUsage() {
         return ;
     }
    
    

See also:
Options.CLI_PROPERTIES
 
     public void setShouldPrintProperties(boolean shouldPrintProperties) {
         this. = shouldPrintProperties;
     }
    
    

See also:
Options.CLI_PROPERTIES
 
     public boolean getShouldPrintProperties() {
         return ;
     }
 
     public boolean isInlineScript() {
         return ;
     }
 
     private boolean isSourceFromStdin() {
         return getScriptFileName() == null;
     }
 
     public void setScriptFileName(String scriptFileName) {
         this. = true;
         this. = scriptFileName;
     }
 
     public String getScriptFileName() {
         return ;
     }
    
    

See also:
Options.CLI_ASSUME_LOOP
 
     public void setAssumeLoop(boolean assumeLoop) {
         this. = assumeLoop;
     }

    

See also:
Options.CLI_ASSUME_LOOP
 
     public boolean isAssumeLoop() {
         return ;
     }
    
    

See also:
Options.CLI_ASSUME_PRINT
 
     public void setAssumePrinting(boolean assumePrinting) {
         this. = assumePrinting;
     }

    

See also:
Options.CLI_ASSUME_PRINT
 
     public boolean isAssumePrinting() {
         return ;
     }
    
    

See also:
Options.CLI_PROCESS_LINE_ENDS
 
     public void setProcessLineEnds(boolean processLineEnds) {
         this. = processLineEnds;
     }

    

See also:
Options.CLI_PROCESS_LINE_ENDS
 
     public boolean isProcessLineEnds() {
         return ;
     }
    
    

See also:
Options.CLI_AUTOSPLIT
 
     public void setSplit(boolean split) {
         this. = split;
     }

    

See also:
Options.CLI_AUTOSPLIT
 
     public boolean isSplit() {
         return ;
     }
    
    

See also:
Options.CLI_WARNING_LEVEL
 
     public Verbosity getVerbosity() {
         return ;
     }
    
    

See also:
Options.CLI_WARNING_LEVEL
 
     public void setVerbosity(Verbosity verbosity) {
         this. = verbosity;
     }

    

See also:
Options.CLI_VERBOSE
 
     public boolean isVerbose() {
         return  == .;
     }

    

See also:
Options.CLI_DEBUG
 
     public boolean isDebug() {
         return ;
     }

    

See also:
Options.CLI_DEBUG
 
     public void setDebug(boolean debug) {
         this. = debug;
     }
    
    

See also:
Options.CLI_PARSER_DEBUG
 
     public boolean isParserDebug() {
         return ;
     }
    
    

See also:
Options.CLI_PARSER_DEBUG
 
     public void setParserDebug(boolean parserDebug) {
         this. = parserDebug;
     }
    
    

See also:
Options.CLI_PARSER_DEBUG
 
     public boolean getParserDebug() {
         return ;
     }

    

See also:
Options.CLI_VERSION
 
     public void setShowVersion(boolean showVersion) {
         this. = showVersion;
     }

    

See also:
Options.CLI_VERSION
 
     public boolean isShowVersion() {
         return ;
     }
    
    

See also:
Options.CLI_BYTECODE
 
     public void setShowBytecode(boolean showBytecode) {
         this. = showBytecode;
     }
    
    

See also:
Options.CLI_BYTECODE
 
     public boolean isShowBytecode() {
         return ;
     }

    

See also:
Options.CLI_COPYRIGHT
 
     public void setShowCopyright(boolean showCopyright) {
         this. = showCopyright;
     }

    

See also:
Options.CLI_COPYRIGHT
 
     public boolean isShowCopyright() {
         return ;
     }
     
     public void setShouldRunInterpreter(boolean shouldRunInterpreter) {
         this. = shouldRunInterpreter;
     }
     
     public boolean getShouldRunInterpreter() {
         return  && ( || !);
     }
    
    

See also:
Options.CLI_CHECK_SYNTAX
 
     public void setShouldCheckSyntax(boolean shouldSetSyntax) {
         this. = shouldSetSyntax;
     }

    

See also:
Options.CLI_CHECK_SYNTAX
 
     public boolean getShouldCheckSyntax() {
         return ;
     }
    
    

See also:
Options.CLI_AUTOSPLIT_SEPARATOR
 
     public void setInputFieldSeparator(String inputFieldSeparator) {
         this. = inputFieldSeparator;
     }

    

See also:
Options.CLI_AUTOSPLIT_SEPARATOR
 
     public String getInputFieldSeparator() {
         return ;
     }

    

See also:
Options.CLI_KCODE
 
     public KCode getKCode() {
         return ;
     }

    

See also:
Options.CLI_KCODE
    public void setKCode(KCode kcode) {
        this. = kcode;
    }
    
    

See also:
Options.CLI_ENCODING_INTERNAL
    public void setInternalEncoding(String internalEncoding) {
        this. = internalEncoding;
    }

    

See also:
Options.CLI_ENCODING_INTERNAL
    public String getInternalEncoding() {
        return ;
    }
    
    

See also:
Options.CLI_ENCODING_EXTERNAL
    public void setExternalEncoding(String externalEncoding) {
        this. = externalEncoding;
    }

    

See also:
Options.CLI_ENCODING_EXTERNAL
    public String getExternalEncoding() {
        return ;
    }

    

See also:
Options.CLI_ENCODING_SOURCE
    public void setSourceEncoding(String sourceEncoding) {
        this. = sourceEncoding;
    }

    

See also:
Options.CLI_ENCODING_SOURCE
    public String getSourceEncoding() {
        return ;
    }
    
    

See also:
Options.CLI_RECORD_SEPARATOR
    public void setRecordSeparator(String recordSeparator) {
        this. = recordSeparator;
    }

    

See also:
Options.CLI_RECORD_SEPARATOR
    public String getRecordSeparator() {
        return ;
    }
    public int getSafeLevel() {
        return 0;
    }
    public ClassCache getClassCache() {
        return ;
    }
    
    

See also:
Options.CLI_BACKUP_EXTENSION
    public void setInPlaceBackupExtension(String inPlaceBackupExtension) {
        this. = inPlaceBackupExtension;
    }

    

See also:
Options.CLI_BACKUP_EXTENSION
        return ;
    }
    public void setClassCache(ClassCache classCache) {
        this. = classCache;
    }
    public Map getOptionGlobals() {
        return ;
    }
    
    public boolean isManagementEnabled() {
        return ;
    }
    
    public Set getExcludedMethods() {
        return ;
    }
    public boolean isArgvGlobalsOn() {
        return ;
    }
    public void setArgvGlobalsOn(boolean argvGlobalsOn) {
        this. = argvGlobalsOn;
    }
    public String getThreadDumpSignal() {
        return ;
    }
    public boolean isHardExit() {
        return ;
    }
    public void setHardExit(boolean hardExit) {
        this. = hardExit;
    }

    

See also:
Options.CLI_PROFILING_MODE
    public boolean isProfiling() {
        return  != .;
    }
    
    

See also:
Options.CLI_PROFILING_MODE
    public boolean isProfilingEntireRun() {
        return  != . &&  != .;
    }
    
    

See also:
Options.CLI_PROFILING_MODE
    public void setProfilingMode(ProfilingMode profilingMode) {
        this. = profilingMode;
    }

    

See also:
Options.CLI_PROFILING_MODE
    public ProfilingMode getProfilingMode() {
        return ;
    }
    public void setProfileOutput(ProfileOutput output) {
        this. = output;
    }
    public ProfileOutput getProfileOutput() {
        return ;
    }
    public boolean hasShebangLine() {
        return ;
    }
    public void setHasShebangLine(boolean hasShebangLine) {
        this. = hasShebangLine;
    }

    

See also:
Options.CLI_RUBYGEMS_ENABLE
    public boolean isDisableGems() {
        return ;
    }

    

See also:
Options.CLI_RUBYGEMS_ENABLE
    public void setDisableGems(boolean dg) {
        this. = dg;
    }

    

See also:
Options.BACKTRACE_STYLE
    public TraceType getTraceType() {
        return ;
    }

    

See also:
Options.BACKTRACE_STYLE
    public void setTraceType(TraceType traceType) {
        this. = traceType;
    }
    public void setHasScriptArgv(boolean argvRemains) {
         = argvRemains;
    }
    
    public boolean getHasScriptArgv() {
        return ;
    }
    
    
Whether to mask .java lines in the Ruby backtrace, as MRI does for C calls.

Returns:
true if masking; false otherwise
See also:
Options.BACKTRACE_MASK
    public boolean getBacktraceMask() {
        return ;
    }

    
Set whether to mask .java lines in the Ruby backtrace.

Parameters:
backtraceMask true to mask; false otherwise
See also:
Options.BACKTRACE_MASK
    public void setBacktraceMask(boolean backtraceMask) {
        this. = backtraceMask;
    }
    
    
Set whether native code is enabled for this config. Disabling it also disables C extensions (@see RubyInstanceConfig#setCextEnabled).

Parameters:
b new value indicating whether native code is enabled
See also:
Options.NATIVE_ENABLED
    public void setNativeEnabled(boolean b) {
         = false;
    }
    
    
Get whether native code is enabled for this config.

Returns:
true if native code is enabled; false otherwise.
See also:
Options.NATIVE_ENABLED
    public boolean isNativeEnabled() {
        return ;
    }
    
    
Set whether C extensions are enabled for this config.

Parameters:
b new value indicating whether native code is enabled
See also:
Options.CEXT_ENABLED
    public void setCextEnabled(boolean b) {
         = b;
    }
    
    
Get whether C extensions are enabled for this config.

Returns:
true if C extensions are enabled; false otherwise.
See also:
Options.CEXT_ENABLED
    public boolean isCextEnabled() {
        return ;
    }
    
    

See also:
Options.CLI_STRIP_HEADER
    public void setXFlag(boolean xFlag) {
        this. = xFlag;
    }

    

See also:
Options.CLI_STRIP_HEADER
    public boolean isXFlag() {
        return ;
    }
    
    
True if colorized backtraces are enabled. False otherwise.

See also:
Options.BACKTRACE_COLOR
    public boolean getBacktraceColor() {
        return ;
    }
    
    
Set to true to enable colorized backtraces.

See also:
Options.BACKTRACE_COLORR
    public void setBacktraceColor(boolean backtraceColor) {
        this. = backtraceColor;
    }
    
    
Whether to use a single global lock for requires.

See also:
Options.GLOBAL_REQUIRE_LOCK
    public boolean isGlobalRequireLock() {
        return ;
    }
    
    
Set whether to use a single global lock for requires.

See also:
Options.GLOBAL_REQUIRE_LOCK
    public void setGlobalRequireLock(boolean globalRequireLock) {
        this. = globalRequireLock;
    }

    
Set whether the JIT compiler should run in a background thread (Executor-based).

Parameters:
jitBackground whether to run the JIT compiler in a background thread
See also:
Options.JIT_BACKGROUND
    public void setJitBackground(boolean jitBackground) {
        this. = jitBackground;
    }

    
Get whether the JIT compiler will run in a background thread.

Returns:
whether the JIT compiler will run in a background thread
See also:
Options.JIT_BACKGROUND
    public boolean getJitBackground() {
        return ;
    }

    
Set whether to load and setup bundler on startup.

See also:
Options.CLI_LOAD_GEMFILE
    public void setLoadGemfile(boolean loadGemfile) {
        this. = loadGemfile;
    }

    
Whether to load and setup bundler on startup.

See also:
Options.CLI_LOAD_GEMFILE
    public boolean getLoadGemfile() {
        return ;
    }

    
Set the maximum number of methods to consider when profiling.

See also:
Options.PROFILE_MAX_METHODS
    public void setProfileMaxMethods(int profileMaxMethods) {
        this. = profileMaxMethods;
    }

    
Get the maximum number of methods to consider when profiling.

See also:
Options.PROFILE_MAX_METHODS
    public int getProfileMaxMethods() {
        return ;
    }
    
    
Set whether Kernel#gsub should be defined
    public void setKernelGsubDefined(boolean setDefineKernelGsub) {
        this. = setDefineKernelGsub;
    }
    
    
Get Kernel#gsub is defined or not
    public boolean getKernelGsubDefined() {
        return ;
    }
    
    
get whether IPv4 is preferred

See also:
Options.PREFER_IPV4
    public boolean getIPv4Preferred() {
        return ;
    }

    
get whether uppercase package names will be honored
    public boolean getAllowUppercasePackageNames() {
        return ;
    }

    
set whether uppercase package names will be honored
    public void setAllowUppercasePackageNames(boolean allow) {
         = allow;
    }
    
    ////////////////////////////////////////////////////////////////////////////
    // Configuration fields.
    ////////////////////////////////////////////////////////////////////////////
    
    
Indicates whether the script must be extracted from script source
    private boolean xFlag = ..load();

    
Indicates whether the script has a shebang line or not
    private boolean hasShebangLine;
    private InputStream input          = .;
    private PrintStream output         = .;
    private PrintStream error          = .;
    private Profile profile            = .;
    private boolean objectSpaceEnabled = ..load();