Package org.jruby.embed.util
Class SystemPropertyCatcher
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 StringfindFromJar(Object instance) Deprecated.static StringfindJRubyHome(Object instance) Deprecated.Deprecated.static 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.static voidsetJRubyHome(ScriptingContainer container) Deprecated.
-
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.
-
setJRubyHome
Deprecated.Sets JRuby home if it is given by a JRUBY_HOME environment variable, jruby.home system property, or jury.home in jruby-complete.jar- Parameters:
container- ScriptingContainer to be set jruby home.
-
findJRubyHome
Deprecated.Tries to find JRuby home from the order of JRUBY_HOME environment variable, jruby.home System property, then "/META-INF/jruby.home" if jruby-complete.jar is used.- Parameters:
instance- any instance to get a resource- Returns:
- JRuby home path if exists, null when failed to find it.
-
findFromJar
Deprecated. -
findLoadPaths
Deprecated.Tries to find load paths for ruby files and/or libraries. This methods sees org.jruby.embed.class.path system property first, then java.class.path.- Returns:
- a list of load paths.
-
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.
-