Top Description Methods
org.jruby.embed

public Interface EmbedRubyInstanceConfigAdapter

Known Direct Implementers
org.jruby.embed.ScriptingContainer
Imports
java.io.InputStream, .PrintStream, .Reader, .Writer, java.util.List, .Map, org.jruby.Profile, .RubyInstanceConfig.CompileMode, .RubyInstanceConfig.LoadServiceCreator, org.jruby.util.KCode

This interface defines methods to configure Ruby runtime for embedding.
Author
Yoko Harada <[email protected]>
Since
JRuby 1.5.0

Method Summary

Modifier and TypeMethod and Description
public String[]

Returns:

an arguments' list.
getArgv
()

Returns an arguments' list.

public ClassLoader

Returns:

a class loader object that is currently used.
getClassLoader
()

Returns a class loader object that is currently used.

public RubyInstanceConfig.CompileMode

Returns:

a compile mode.
getCompileMode
()

Returns a compile mode currently chosen, which is one of CompileMode.JIT, CompileMode.FORCE, CompileMode.OFF.

public String

Returns:

a current directory.
getCurrentDirectory
()

Returns a current directory.

public Map<K, V>

Returns:

a map that has environment variables' key-value pairs.
getEnvironment
()

Returns a map of environment variables.

public PrintStream

Returns:

output stream for error stream
getError
()

Returns an error stream assigned to STDERR and $stderr.

public String

Returns:

a JRuby home directory.
getHomeDirectory
()

Returns a JRuby home directory.

public InputStream

Returns:

input stream of STDIN and $stdin
getInput
()

Returns an input stream assigned to STDIN and $stdin.

public int

Returns:

a value that determines how often jitted methods are logged.
getJitLogEvery
()

Returns the value of n, which means that jitted methods are logged in every n methods.

public int

Returns:

a value of a max class cache size.
getJitMax
()

Returns a value of a max class cache size.

public int

Returns:

a value of a max size of the bytecode.
getJitMaxSize
()

Returns a value of a max size of the bytecode generated by compiler.

public int

Returns:

a value of the threshold.
getJitThreshold
()

Returns a value of the threshold that determines whether jitted methods' call reached to the limit or not.

public KCode

Returns:

a KCode value.
getKCode
()

Returns a value of KCode currently used.

public List<String>

Returns:

a list of load paths.
getLoadPaths
()

Returns a list of load paths for Ruby scripts/libraries.

public RubyInstanceConfig.LoadServiceCreator

Returns:

a current LoadServiceCreator.
getLoadServiceCreator
()

Returns a LoadServiceCreator currently used.

public PrintStream

Returns:

an output stream of STDOUT and $stdout
getOutput
()

Returns an output stream assigned to STDOUT and $stdout

public Profile

Returns:

a current profiler.
getProfile
()

Returns a profiler currently used.

public String

Returns:

a record separator.
getRecordSeparator
()

Returns a record separator.

public String

Returns:

a script filename.
getScriptFilename
()

Returns a script filename to run.

public String

Returns:

version information.
getSupportedRubyVersion
()

Returns version information about JRuby and Ruby supported by this platform.

public boolean

Returns:

true if the Object Space is able to use, otherwise, false.
isObjectSpaceEnabled
()

Tests whether the Object Space is enabled or not.

public boolean

Returns:

true if Ruby is configured to run in a process, otherwise, false.
isRunRubyInProcess
()

Tests whether Ruby runs in a process or not.

public void
setArgv(String[]
a new arguments' list.
argv
)

Changes values of the arguments' list.

public void
setClassLoader(ClassLoader
a new class loader to be set.
loader
)

Changes a class loader to a given loader.

public void
setCompileMode(RubyInstanceConfig.CompileMode
compile mode
mode
)

Changes a compile mode to a given mode, which should be one of CompileMode.JIT, CompileMode.FORCE, CompileMode.OFF.

public void
setCurrentDirectory(String
a new directory to be set.
directory
)

Changes a current directory to a given directory.

public void
setEnvironment(Map<K, V>
a new map of environment variables.
environment
)

Changes an environment variables' map.

public void
setError(PrintStream
a print stream to be set
pstream
)

Changes STDERR and $stderr to a gievn print stream.

public void
setError(Writer
a writer to be set
writer
)

Changes STDERR and $stderr to a given writer.

public void
setHomeDirectory(String
a name of new JRuby home directory.
home
)

Changes a JRuby home directroy to a directory of a given name.

public void
setInput(InputStream
an input stream to be set
istream
)

Changes STDIN and $stdin to a given input stream.

public void
setInput(Reader
a reader to be set
reader
)

Changes STDIN and $stdin to a given reader.

public void
setJitLogEvery(int
a new number of methods.
logEvery
)

Changes a value of n, so that jitted methods are logged in every n methods.

public void
setJitMax(int
a new value of a max class cache size.
max
)

Changes a value of a max class cache size.

public void
setJitMaxSize(int
a new value of a max size of the bytecode.
maxSize
)

Changes a value of a max size of the bytecode generated by compiler.

public void
setJitThreshold(int
a new value of the threshold.
threshold
)

Changes a value of the threshold that determines whether jitted methods' call reached to the limit or not.

public void
setKCode(KCode
a new KCode value.
kcode
)

Changes a value of KCode to a given value.

public void
setLoadPaths(List<String>
a new list of load paths.
paths
)

Changes a list of load paths Ruby scripts/libraries.

public void
setLoadServiceCreator(RubyInstanceConfig.LoadServiceCreator
a new LoadServiceCreator
creator
)

Changes a LoadServiceCreator to a given one.

public void
setObjectSpaceEnabled(boolean
true to enable the Object Space, or false to disable.
enable
)

Changes the value to determine whether the Object Space is enabled or not.

public void
setOutput(PrintStream
an output stream to be set
pstream
)

Changes STDOUT and $stdout to a given output stream.

public void
setOutput(Writer
a writer to be set
writer
)

Changes STDOUT and $stdout to a given writer.

public void
setProfile(Profile
a new profiler to be set.
profile
)

Changes a profiler to a given one.

public void
setRecordSeparator(String
a new record separator value, "0" or "777"
separator
)

Changes a record separator to a given value.

public void
setRunRubyInProcess(boolean
true when Ruby is set to run in the process, or false not to run in the process.
inprocess
)

Changes the value to determine whether Ruby runs in a process or not.

public void
setScriptFilename(String
a new script filename.
filename
)

Changes a script filename to run.

Method Detail

getArgvback to summary
public String[] getArgv()

Returns an arguments' list.

Returns:String[]

an arguments' list.

getClassLoaderback to summary
public ClassLoader getClassLoader()

Returns a class loader object that is currently used. This loader loads Ruby files and libraries.

Returns:ClassLoader

a class loader object that is currently used.

getCompileModeback to summary
public RubyInstanceConfig.CompileMode getCompileMode()

Returns a compile mode currently chosen, which is one of CompileMode.JIT, CompileMode.FORCE, CompileMode.OFF. The default mode is CompileMode.OFF.

Returns:RubyInstanceConfig.CompileMode

a compile mode.

getCurrentDirectoryback to summary
public String getCurrentDirectory()

Returns a current directory. The default current directory is identical to a value of "user.dir" system property if no security restriction is set. If the "user.dir" directory is protected by the security restriction, the default value is "/".

Returns:String

a current directory.

getEnvironmentback to summary
public Map<K, V> getEnvironment()

Returns a map of environment variables.

Returns:Map<K, V>

a map that has environment variables' key-value pairs.

getErrorback to summary
public PrintStream getError()

Returns an error stream assigned to STDERR and $stderr.

Returns:PrintStream

output stream for error stream

getHomeDirectoryback to summary
public String getHomeDirectory()

Returns a JRuby home directory. The default JRuby home is the value of JRUBY_HOME environmet variable, or "jruby.home" system property when no security restriction is set to those directories. If none of JRUBY_HOME or jruby.home is set and jruby-complete.jar is used, the default JRuby home is "/META-INF/jruby.home" in the jar archive. Otherwise, "java.io.tmpdir" system property is the default value.

Returns:String

a JRuby home directory.

getInputback to summary
public InputStream getInput()

Returns an input stream assigned to STDIN and $stdin.

Returns:InputStream

input stream of STDIN and $stdin

getJitLogEveryback to summary
public int getJitLogEvery()

Returns the value of n, which means that jitted methods are logged in every n methods. The default value is 0.

Returns:int

a value that determines how often jitted methods are logged.

getJitMaxback to summary
public int getJitMax()

Returns a value of a max class cache size. The default value is 0 when security restriction is applied, or 4096 when no security restriction exists.

Returns:int

a value of a max class cache size.

getJitMaxSizeback to summary
public int getJitMaxSize()

Returns a value of a max size of the bytecode generated by compiler. The default value is -1 when security restriction is applied, or 10000 when no security restriction exists.

Returns:int

a value of a max size of the bytecode.

getJitThresholdback to summary
public int getJitThreshold()

Returns a value of the threshold that determines whether jitted methods' call reached to the limit or not. The default value is -1 when security restriction is applied, or 50 when no security restriction exists.

Returns:int

a value of the threshold.

getKCodeback to summary
public KCode getKCode()

Returns a value of KCode currently used. The default value is KCode.NONE.

Returns:KCode

a KCode value.

getLoadPathsback to summary
public List<String> getLoadPaths()

Returns a list of load paths for Ruby scripts/libraries. If no paths is given, the list is created from java.class.path System property.

Returns:List<String>

a list of load paths.

getLoadServiceCreatorback to summary
public RubyInstanceConfig.LoadServiceCreator getLoadServiceCreator()

Returns a LoadServiceCreator currently used.

Returns:RubyInstanceConfig.LoadServiceCreator

a current LoadServiceCreator.

getOutputback to summary
public PrintStream getOutput()

Returns an output stream assigned to STDOUT and $stdout

Returns:PrintStream

an output stream of STDOUT and $stdout

getProfileback to summary
public Profile getProfile()

Returns a profiler currently used. The default profiler is Profile.DEFAULT, which has the same behavior to Profile.ALL.

Returns:Profile

a current profiler.

getRecordSeparatorback to summary
public String getRecordSeparator()

Returns a record separator. The default value is \0.

Returns:String

a record separator.

getScriptFilenameback to summary
public String getScriptFilename()

Returns a script filename to run. The default value is null.

Returns:String

a script filename.

getSupportedRubyVersionback to summary
public String getSupportedRubyVersion()

Returns version information about JRuby and Ruby supported by this platform.

Returns:String

version information.

isObjectSpaceEnabledback to summary
public boolean isObjectSpaceEnabled()

Tests whether the Object Space is enabled or not.

Returns:boolean

true if the Object Space is able to use, otherwise, false.

isRunRubyInProcessback to summary
public boolean isRunRubyInProcess()

Tests whether Ruby runs in a process or not.

Returns:boolean

true if Ruby is configured to run in a process, otherwise, false.

setArgvback to summary
public void setArgv(String[] argv)

Changes values of the arguments' list.

Parameters
argv:String[]

a new arguments' list.

setClassLoaderback to summary
public void setClassLoader(ClassLoader loader)

Changes a class loader to a given loader.

Parameters
loader:ClassLoader

a new class loader to be set.

setCompileModeback to summary
public void setCompileMode(RubyInstanceConfig.CompileMode mode)

Changes a compile mode to a given mode, which should be one of CompileMode.JIT, CompileMode.FORCE, CompileMode.OFF. The default value is CompileMode.OFF.

Parameters
mode:RubyInstanceConfig.CompileMode

compile mode

setCurrentDirectoryback to summary
public void setCurrentDirectory(String directory)

Changes a current directory to a given directory.

Parameters
directory:String

a new directory to be set.

setEnvironmentback to summary
public void setEnvironment(Map<K, V> environment)

Changes an environment variables' map.

Parameters
environment:Map<K, V>

a new map of environment variables.

setErrorback to summary
public void setError(PrintStream pstream)

Changes STDERR and $stderr to a gievn print stream. The default standard error is java.lang.System.err.

Parameters
pstream:PrintStream

a print stream to be set

setErrorback to summary
public void setError(Writer writer)

Changes STDERR and $stderr to a given writer. No writer is set by default.

Parameters
writer:Writer

a writer to be set

setHomeDirectoryback to summary
public void setHomeDirectory(String home)

Changes a JRuby home directroy to a directory of a given name.

Parameters
home:String

a name of new JRuby home directory.

setInputback to summary
public void setInput(InputStream istream)

Changes STDIN and $stdin to a given input stream. The default standard input is java.lang.System.in.

Parameters
istream:InputStream

an input stream to be set

setInputback to summary
public void setInput(Reader reader)

Changes STDIN and $stdin to a given reader. No reader is set by default.

Parameters
reader:Reader

a reader to be set

setJitLogEveryback to summary
public void setJitLogEvery(int logEvery)

Changes a value of n, so that jitted methods are logged in every n methods. The default value is 0. This value can be set by the jruby.jit.logEvery System property.

Parameters
logEvery:int

a new number of methods.

setJitMaxback to summary
public void setJitMax(int max)

Changes a value of a max class cache size. The default value is 0 when security restriction is applied, or 4096 when no security restriction exists. This value can be set by jruby.jit.max System property.

Parameters
max:int

a new value of a max class cache size.

setJitMaxSizeback to summary
public void setJitMaxSize(int maxSize)

Changes a value of a max size of the bytecode generated by compiler. The default value is -1 when security restriction is applied, or 10000 when no security restriction exists. This value can be set by jruby.jit.maxsize System property.

Parameters
maxSize:int

a new value of a max size of the bytecode.

setJitThresholdback to summary
public void setJitThreshold(int threshold)

Changes a value of the threshold that determines whether jitted methods' call reached to the limit or not. The default value is -1 when security restriction is applied, or 50 when no security restriction exists. This value can be set by jruby.jit.threshold System property.

Parameters
threshold:int

a new value of the threshold.

setKCodeback to summary
public void setKCode(KCode kcode)

Changes a value of KCode to a given value. The default value is KCode.NONE.

Parameters
kcode:KCode

a new KCode value.

setLoadPathsback to summary
public void setLoadPaths(List<String> paths)

Changes a list of load paths Ruby scripts/libraries. The default value is an empty array. If no paths is given, the list is created from java.class.path System property. This value can be set by org.jruby.embed.class.path System property.

Parameters
paths:List<String>

a new list of load paths.

setLoadServiceCreatorback to summary
public void setLoadServiceCreator(RubyInstanceConfig.LoadServiceCreator creator)

Changes a LoadServiceCreator to a given one.

Parameters
creator:RubyInstanceConfig.LoadServiceCreator

a new LoadServiceCreator

setObjectSpaceEnabledback to summary
public void setObjectSpaceEnabled(boolean enable)

Changes the value to determine whether the Object Space is enabled or not. The default value is false. This value can be set by jruby.objectspace.enabled system property.

Parameters
enable:boolean

true to enable the Object Space, or false to disable.

setOutputback to summary
public void setOutput(PrintStream pstream)

Changes STDOUT and $stdout to a given output stream. The default standard output is java.lang.System.out.

Parameters
pstream:PrintStream

an output stream to be set

setOutputback to summary
public void setOutput(Writer writer)

Changes STDOUT and $stdout to a given writer. No writer is set by default.

Parameters
writer:Writer

a writer to be set

setProfileback to summary
public void setProfile(Profile profile)

Changes a profiler to a given one.

Parameters
profile:Profile

a new profiler to be set.

setRecordSeparatorback to summary
public void setRecordSeparator(String separator)

Changes a record separator to a given value. If "0" is given, the record separator goes to "\n\n", "777" goes to "￿", otherwise, an octal value of the given number.

Parameters
separator:String

a new record separator value, "0" or "777"

setRunRubyInProcessback to summary
public void setRunRubyInProcess(boolean inprocess)

Changes the value to determine whether Ruby runs in a process or not. The default value is true.

Parameters
inprocess:boolean

true when Ruby is set to run in the process, or false not to run in the process.

setScriptFilenameback to summary
public void setScriptFilename(String filename)

Changes a script filename to run. The default value is null.

Parameters
filename:String

a new script filename.