java.lang.Object
org.jruby.embed.util.SystemPropertyCatcher
Utility methods to retrieve System properties or environment variables to
get configuration parameters.
- Author:
- Yoko Harada <[email protected]>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringReturns a possible base directory.static LocalVariableBehaviorgetBehavior(LocalVariableBehavior defaultBehavior) Gets a local variable behavior from System property.static LocalContextScopegetScope(LocalContextScope defaultScope) Gets a local context scope from System property.static booleanisLazy(boolean defaultLaziness) Gets a local variable behavior from System property.static voidsetClassLoader(ScriptingContainer container) Sets classloader based on System property.static voidsetConfiguration(ScriptingContainer container) Sets configuration parameters given by System properties.
-
Constructor Details
-
SystemPropertyCatcher
public SystemPropertyCatcher()
-
-
Method Details
-
getScope
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
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
Sets classloader based on System property. This is only used from JRubyEgnineFactory.- Parameters:
container- ScriptingContainer to be set classloader
-
setConfiguration
Sets configuration parameters given by System properties. Compile mode and Compat version can be set.- Parameters:
container- ScriptingContainer to be set configurations.
-
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.
-