Class SystemPropertyCatcher

java.lang.Object
org.jruby.embed.util.SystemPropertyCatcher

public class SystemPropertyCatcher extends Object
Utility methods to retrieve System properties or environment variables to get configuration parameters.
Author:
Yoko Harada <[email protected]>
  • Constructor Details

    • SystemPropertyCatcher

      public SystemPropertyCatcher()
  • Method Details

    • getScope

      public static LocalContextScope getScope(LocalContextScope defaultScope)
      Gets a local context scope from System property. If no value is assigned to PropertyName.LOCALCONTEXT_SCOPE, given default value is applied.
      Parameters:
      defaultScope - a default scope.
      Returns:
      one of three local context scopes.
    • getBehavior

      public static LocalVariableBehavior getBehavior(LocalVariableBehavior defaultBehavior)
      Gets a local variable behavior from System property. If no value is assigned to PropertyName.LOCALVARIABLE_BEHAVIOR, given default value is applied.
      Parameters:
      defaultBehavior - a default local variable behavior
      Returns:
      a local variable behavior
    • isLazy

      public static boolean isLazy(boolean defaultLaziness)
      Gets a local variable behavior from System property. If no value is assigned to PropertyName.LOCALVARIABLE_BEHAVIOR, given default value is applied.
      Parameters:
      defaultLaziness - a default local variable behavior
      Returns:
      a local variable behavior
    • setClassLoader

      public static void setClassLoader(ScriptingContainer container)
      Sets classloader based on System property. This is only used from JRubyEgnineFactory.
      Parameters:
      container - ScriptingContainer to be set classloader
    • setConfiguration

      public static void setConfiguration(ScriptingContainer container)
      Sets configuration parameters given by System properties. Compile mode and Compat version can be set.
      Parameters:
      container - ScriptingContainer to be set configurations.
    • getBaseDir

      public static String getBaseDir()
      Returns a possible base directory. PWD environment variables is looked up first, then user.dir System property second. This directory is used as a default value when base directory is not given.
      Returns:
      a base directory.