org.jruby
Class Ruby

java.lang.Object
  extended by org.jruby.Ruby

public final class Ruby
extends java.lang.Object

The Ruby object represents the top-level of a JRuby "instance" in a given VM. JRuby supports spawning multiple instances in the same JVM. Generally, objects created under these instances are tied to a given runtime, for such details as identity and type, because multiple Ruby instances means there are multiple instances of each class. This means that in multi-runtime mode (or really, multi-VM mode, where each JRuby instance is a ruby "VM"), objects generally can't be transported across runtimes without marshaling. This class roots everything that makes the JRuby runtime function, and provides a number of utility methods for constructing global types and accessing global runtime structures.


Nested Class Summary
 class Ruby.CallTraceFuncHook
           
 
Field Summary
 RubyFixnum[] fixnumCache
           
static int NIL_PREFILLED_ARRAY_SIZE
           
 
Method Summary
 void addEventHook(EventHook hook)
           
 void addFinalizer(Finalizable finalizer)
           
 void addInternalFinalizer(Finalizable finalizer)
           
 int allocModuleId()
           
 int allocSymbolId()
           
 CallbackFactory callbackFactory(java.lang.Class<?> type)
           
 void callEventHooks(ThreadContext context, RubyEvent event, java.lang.String file, int line, java.lang.String name, IRubyObject type)
           
 void checkSafeString(IRubyObject object)
           
 void compileAndLoadFile(java.lang.String filename, java.io.InputStream in, boolean wrap)
           
 RubyClass defineClass(java.lang.String name, RubyClass superClass, ObjectAllocator allocator)
          Define a new class under the Object namespace.
 RubyClass defineClass(java.lang.String name, RubyClass superClass, ObjectAllocator allocator, CallSite[] callSites)
          A variation of defineClass that allows passing in an array of subplementary call sites for improving dynamic invocation performance.
 RubyClass defineClassUnder(java.lang.String name, RubyClass superClass, ObjectAllocator allocator, RubyModule parent)
          Define a new class with the given name under the given module or class namespace.
 RubyClass defineClassUnder(java.lang.String name, RubyClass superClass, ObjectAllocator allocator, RubyModule parent, CallSite[] callSites)
          A variation of defineClassUnder that allows passing in an array of supplementary call sites to improve dynamic invocation.
 void defineGlobalConstant(java.lang.String name, IRubyObject value)
          rb_define_global_const
 RubyModule defineModule(java.lang.String name)
          Define a new module under the Object namespace.
 RubyModule defineModuleUnder(java.lang.String name, RubyModule parent)
          Define a new module with the given name under the given module or class namespace.
 void defineReadonlyVariable(java.lang.String name, IRubyObject value)
          defines a readonly global variable
 void defineVariable(GlobalVariable variable)
          Defines a global variable
 IRubyObject evalScriptlet(java.lang.String script)
          Evaluates a script under the current scope (perhaps the top-level scope) and returns the result (generally the last value calculated).
 IRubyObject evalScriptlet(java.lang.String script, DynamicScope scope)
          Evaluates a script under the current scope (perhaps the top-level scope) and returns the result (generally the last value calculated).
 IRubyObject executeScript(java.lang.String script, java.lang.String filename)
          Parse and execute the specified script This differs from the other methods in that it accepts a string-based script and parses and runs it as though it were loaded at a command-line.
 RubyClass fastGetClass(java.lang.String internedName)
          Retrieve the class with the given name from the Object namespace.
 RubyModule fastGetModule(java.lang.String internedName)
          Retrieve the module with the given name from the Object namespace.
 RubySymbol fastNewSymbol(java.lang.String internedName)
          Faster than newSymbol(String) if you already have an interned name String.
 RubyClass getArgumentError()
           
 RubyClass getArray()
           
 RubyClass getBasicObject()
           
 BeanManager getBeanManager()
           
 RubyClass getBignum()
           
 RubyClass getBinding()
           
 RubyHash getCharsetMap()
           
 RubyClass getClass(java.lang.String name)
          Retrieve the class with the given name from the Object namespace.
 RubyClass getClassClass()
           
 RubyModule getClassFromPath(java.lang.String path)
           
static java.lang.ClassLoader getClassLoader()
           
 RubyModule getComparable()
           
 RubyClass getComplex()
           
 RubyClass getConcurrencyError()
           
 int getConstantGeneration()
           
 RubyClass getContinuation()
           
 RubyClass getConverter()
           
 ThreadContext getCurrentContext()
           
 java.lang.String getCurrentDirectory()
           
static Ruby getCurrentInstance()
          Deprecated. 
 IRubyObject getDebug()
          Getter for property isDebug.
 org.jcodings.Encoding getDefaultExternalEncoding()
           
static Ruby getDefaultInstance()
          Deprecated. use #newInstance()
 org.jcodings.Encoding getDefaultInternalEncoding()
           
 DynamicMethod getDefaultMethodMissing()
           
 RubyThreadGroup getDefaultThreadGroup()
           
 ChannelDescriptor getDescriptorByFileno(int aFileno)
           
 java.util.Map<java.lang.Integer,org.jruby.Ruby.WeakDescriptorReference> getDescriptors()
           
 RubyClass getDir()
           
 RubyClass getDummy()
           
 RubyClass getEncoding()
           
 RubyClass getEncodingCompatibilityError()
           
 RubyClass getEncodingError()
           
 EncodingService getEncodingService()
           
 RubyModule getEnumerable()
           
 RubyClass getEnumerator()
           
 RubyClass getEOFError()
           
 java.io.PrintStream getErr()
           
 RubyModule getErrno()
           
 RubyClass getErrno(int n)
           
 java.io.PrintStream getErrorStream()
           
 RubyModule getEtc()
           
 RubyClass getException()
           
 java.util.concurrent.ExecutorService getExecutor()
           
 RubyBoolean getFalse()
          Returns the "false" instance from the instance pool.
 RubyClass getFalseClass()
           
 RubyClass getFatal()
           
 RubyClass getFile()
           
 RubyClass getFileStat()
           
 RubyModule getFileTest()
           
 RubyClass getFixnum()
           
 RubyClass getFloat()
           
 RubyClass getFloatDomainError()
           
 RubyModule getGC()
           
static Ruby getGlobalRuntime()
           
 long getGlobalState()
          GET_VM_STATE_VERSION
 GlobalVariables getGlobalVariables()
           
 IRubyObject getGroupStruct()
           
 RubyClass getHash()
           
 java.lang.Object getHierarchyLock()
          Get the global object used to synchronize class-hierarchy modifications like cache invalidation, subclass sets, and included hierarchy sets.
 java.io.InputStream getIn()
           
 RubyClass getIndexError()
           
 java.io.InputStream getInputStream()
           
 RubyInstanceConfig getInstanceConfig()
           
 RubyClass getInteger()
           
 RubyClass getInterrupt()
           
 RubyClass getIO()
           
 RubyClass getIOError()
           
 JavaSupport getJavaSupport()
           
 JITCompiler getJITCompiler()
           
 java.util.Set<Script> getJittedMethods()
           
 JRubyClassLoader getJRubyClassLoader()
           
 java.lang.String getJRubyHome()
           
 KCode getKCode()
           
 RubyModule getKernel()
           
 RubyClass getLoadError()
           
 LoadService getLoadService()
          Returns the loadService.
 RubyClass getLocalJumpError()
           
 RubyModule getMarshal()
           
 RubyClass getMatchData()
           
 RubyModule getMath()
           
 RubyClass getMethod()
           
 RubyClass getModule()
           
 RubyModule getModule(java.lang.String name)
          Retrieve the module with the given name from the Object namespace.
 RubyClass getNameError()
           
 RubyClass getNameErrorMessage()
           
 RubyClass getNativeException()
           
 long getNextDynamicMethodSerial()
          Get a new serial number for a new DynamicMethod instance
 IRubyObject getNil()
          Returns the "nil" singleton instance.
 RubyClass getNilClass()
           
 IRubyObject[] getNilPrefilledArray()
           
 RubyClass getNoMemoryError()
           
 RubyClass getNoMethodError()
           
 DynamicMethod getNormalMethodMissing()
           
 RubyClass getNotImplementedError()
           
 RubyClass getNumeric()
           
 RubyClass getObject()
           
 ObjectSpace getObjectSpace()
           
 RubyModule getObjectSpaceModule()
           
 RubyModule getOrCreateModule(java.lang.String name)
          From Object, retrieve the named module.
 java.io.PrintStream getOut()
           
 java.io.PrintStream getOutputStream()
           
 Parser getParser()
           
 IRubyObject getPasswdStruct()
           
 org.jruby.ext.posix.POSIX getPosix()
           
 RubyModule getPrecision()
           
 DynamicMethod getPrivateMethodMissing()
           
 RubyClass getProc()
           
 RubyModule getProcess()
           
 RubyModule getProcGID()
           
 RubyClass getProcStatus()
           
 RubyModule getProcSysModule()
           
 RubyModule getProcUID()
           
 Profile getProfile()
           
 DynamicMethod getProtectedMethodMissing()
           
 java.util.Random getRandom()
           
 long getRandomSeed()
           
 RubyClass getRange()
           
 RubyClass getRangeError()
           
 RubyClass getRational()
           
 GlobalVariable getRecordSeparatorVar()
           
 RubyClass getRegexp()
           
 RubyClass getRegexpError()
           
 java.lang.Object getRespondToMethod()
           
 RubyClass getRuntimeError()
           
 int getSafeLevel()
          Retrieve the current safe level.
 RubyClass getSecurityError()
           
 RubyClass getSignalException()
           
 IRubyObject[] getSingleNilArray()
           
 int getStackTraces()
           
 RubyClass getStandardError()
           
 long getStartTime()
           
 RubyClass getStopIteration()
           
 RubyClass getString()
           
 RubyClass getStructClass()
           
 DynamicMethod getSuperMethodMissing()
           
 RubyClass getSymbol()
           
 RubySymbol.SymbolTable getSymbolTable()
           
 RubyClass getSyntaxError()
           
 RubyClass getSystemCallError()
           
 RubyClass getSystemExit()
           
 RubyClass getSystemStackError()
           
 RubyClass getThread()
           
 RubyClass getThreadError()
           
 RubyClass getThreadGroup()
           
 ThreadService getThreadService()
           
 RubyClass getTime()
           
 java.util.Map<java.lang.String,org.joda.time.DateTimeZone> getTimezoneCache()
           
 IRubyObject getTmsStruct()
           
 IRubyObject getTopSelf()
          Getter for property rubyTopSelf.
 RubyBoolean getTrue()
          Returns the "true" instance from the instance pool.
 RubyClass getTrueClass()
           
 RubyClass getTypeError()
           
 RubyClass getUnboundMethod()
           
 DynamicMethod getVariableMethodMissing()
           
 IRubyObject getVerbose()
          Getter for property isVerbose.
 RubyWarnings getWarnings()
           
 RubyClass getYielder()
           
 RubyClass getZeroDivisionError()
           
 boolean hasEventHooks()
           
 void incGlobalState()
          INC_VM_STATE_VERSION
 void incrementConstantGeneration()
           
 long incrementRandomSeedSequence()
           
 boolean is1_9()
           
 boolean isClassDefined(java.lang.String name)
           
 boolean isDoNotReverseLookupEnabled()
           
 boolean isGlobalAbortOnExceptionEnabled()
           
 boolean isInspecting(java.lang.Object obj)
           
 boolean isObjectSpaceEnabled()
           
static boolean isSecurityRestricted()
           
 boolean isVerbose()
           
<E extends java.lang.Enum<E>>
void
loadConstantSet(RubyModule module, java.lang.Class<E> enumClass)
           
 void loadConstantSet(RubyModule module, java.lang.String constantSetName)
           
 void loadFile(java.lang.String scriptName, java.io.InputStream in, boolean wrap)
           
 void loadScript(Script script)
           
 RaiseException newArgumentError(int got, int expected)
           
 RaiseException newArgumentError(java.lang.String message)
           
 RubyArray newArray()
           
 RubyArray newArray(int size)
           
 RubyArray newArray(IRubyObject... objects)
           
 RubyArray newArray(IRubyObject object)
           
 RubyArray newArray(IRubyObject car, IRubyObject cdr)
           
 RubyArray newArray(java.util.List<IRubyObject> list)
           
 RubyArray newArrayLight()
           
 RubyArray newArrayNoCopy(IRubyObject... objects)
           
 RubyArray newArrayNoCopyLight(IRubyObject... objects)
           
 RubyBinding newBinding()
           
 RubyBinding newBinding(Binding binding)
           
 RubyProc newBlockPassProc(Block.Type type, Block block)
           
 RubyBoolean newBoolean(boolean value)
           
 RaiseException newConcurrencyError(java.lang.String message)
           
 RubyObject.Data newData(RubyClass objectClass, java.lang.Object sval)
           
 RubyArray newEmptyArray()
           
 RaiseException newEncodingCompatibilityError(java.lang.String message)
           
 RaiseException newEncodingError(java.lang.String message)
           
 RaiseException newEOFError()
           
 RaiseException newEOFError(java.lang.String message)
           
 RaiseException newErrnoEACCESError(java.lang.String message)
           
 RaiseException newErrnoEADDRINUSEError()
           
 RaiseException newErrnoEAGAINError(java.lang.String message)
           
 RaiseException newErrnoEBADFError()
           
 RaiseException newErrnoEBADFError(java.lang.String message)
           
 RaiseException newErrnoECHILDError()
           
 RaiseException newErrnoECONNREFUSEDError()
           
 RaiseException newErrnoECONNRESETError()
           
 RaiseException newErrnoEDOMError(java.lang.String message)
           
 RaiseException newErrnoEEXISTError(java.lang.String message)
           
 RaiseException newErrnoEINVALError()
           
 RaiseException newErrnoEINVALError(java.lang.String message)
           
 RaiseException newErrnoEISDirError()
           
 RaiseException newErrnoEISDirError(java.lang.String message)
           
 RaiseException newErrnoENOENTError()
           
 RaiseException newErrnoENOENTError(java.lang.String message)
           
 RaiseException newErrnoENOPROTOOPTError()
           
 RaiseException newErrnoENOTDIRError(java.lang.String message)
           
 RaiseException newErrnoENOTSOCKError(java.lang.String message)
           
 RaiseException newErrnoEPIPEError()
           
 RaiseException newErrnoESPIPEError()
           
 RaiseException newErrnoESPIPEError(java.lang.String message)
           
 RaiseException newErrnoFromLastPOSIXErrno()
           
 RubyFileStat newFileStat(java.io.FileDescriptor descriptor)
           
 RubyFileStat newFileStat(java.lang.String filename, boolean lstat)
           
 RubyFixnum newFixnum(com.kenai.constantine.Constant value)
           
 RubyFixnum newFixnum(int value)
           
 RubyFixnum newFixnum(long value)
           
 RubyFloat newFloat(double value)
           
 RaiseException newFloatDomainError(java.lang.String message)
           
 RaiseException newFrozenError(java.lang.String objectType)
           
 RaiseException newIndexError(java.lang.String message)
           
static Ruby newInstance()
          Returns a new instance of the JRuby runtime configured with defaults.
static Ruby newInstance(java.io.InputStream in, java.io.PrintStream out, java.io.PrintStream err)
          Returns a new instance of the JRuby runtime configured with the given input, output and error streams and otherwise default configuration (except where specified system properties alter defaults).
static Ruby newInstance(RubyInstanceConfig config)
          Returns a new instance of the JRuby runtime configured as specified.
 RaiseException newInvalidEncoding(java.lang.String message)
           
 RaiseException newIOError(java.lang.String message)
           
 RaiseException newIOErrorFromException(java.io.IOException ioe)
           
 RaiseException newLoadError(java.lang.String message)
           
 RaiseException newLocalJumpError(RubyLocalJumpError.Reason reason, IRubyObject exitValue, java.lang.String message)
           
 RaiseException newLocalJumpErrorNoBlock()
           
 RaiseException newNameError(java.lang.String message, java.lang.String name)
           
 RaiseException newNameError(java.lang.String message, java.lang.String name, java.lang.Throwable origException)
           
 RaiseException newNameError(java.lang.String message, java.lang.String name, java.lang.Throwable origException, boolean printWhenVerbose)
           
 RaiseException newNoMethodError(java.lang.String message, java.lang.String name, IRubyObject args)
           
 RaiseException newNotImplementedError(java.lang.String message)
           
 RubyNumeric newNumeric()
           
 RubyProc newProc(Block.Type type, Block block)
           
 RaiseException newRangeError(java.lang.String message)
           
 RaiseException newRedoLocalJumpError()
           
 RaiseException newRegexpError(java.lang.String message)
           
 RaiseException newRuntimeError(java.lang.String message)
           
 RaiseException newSecurityError(java.lang.String message)
           
 RaiseException newStandardError(java.lang.String message)
           
 RubyString newString()
           
 RubyString newString(org.jruby.util.ByteList byteList)
           
 RubyString newString(java.lang.String string)
           
 RubyString newStringShared(org.jruby.util.ByteList byteList)
          Deprecated. 
 RubySymbol newSymbol(java.lang.String name)
           
 RaiseException newSyntaxError(java.lang.String message)
           
 RaiseException newSystemCallError(java.lang.String message)
           
 RaiseException newSystemExit(int status)
           
 RaiseException newSystemStackError(java.lang.String message)
           
 RaiseException newSystemStackError(java.lang.String message, java.lang.StackOverflowError soe)
           
 RaiseException newThreadError(java.lang.String message)
           
 RubyTime newTime(long milliseconds)
           
 RaiseException newTypeError(IRubyObject receivedObject, RubyClass expectedType)
           
 RaiseException newTypeError(java.lang.String message)
           
 RaiseException newZeroDivisionError()
           
 Node parse(org.jruby.util.ByteList content, java.lang.String file, DynamicScope scope, int lineNumber, boolean extraPositionInformation)
           
 Node parse(java.lang.String content, java.lang.String file, DynamicScope scope, int lineNumber, boolean extraPositionInformation)
          Deprecated. 
 Node parseEval(org.jruby.util.ByteList content, java.lang.String file, DynamicScope scope, int lineNumber)
           
 Node parseEval(java.lang.String content, java.lang.String file, DynamicScope scope, int lineNumber)
           
 Node parseFile(java.io.InputStream in, java.lang.String file, DynamicScope scope)
           
 Node parseFile(java.io.InputStream in, java.lang.String file, DynamicScope scope, int lineNumber)
           
 Node parseFromMain(java.io.InputStream inputStream, java.lang.String filename)
          Parse the script contained in the given input stream, using the given filename as the name of the script, and return the root Node.
 Node parseInline(java.io.InputStream in, java.lang.String file, DynamicScope scope)
           
 void printError(RubyException excp)
          Prints an error with backtrace to the error stream.
 IRubyObject pushExitBlock(RubyProc proc)
          Push block onto exit stack.
 void registerDescriptor(ChannelDescriptor descriptor)
           
 void registerDescriptor(ChannelDescriptor descriptor, boolean isRetained)
           
 void registerInspecting(java.lang.Object obj)
           
 void removeEventHook(EventHook hook)
           
 void removeFinalizer(Finalizable finalizer)
           
 void removeInternalFinalizer(Finalizable finalizer)
           
 void runFromMain(java.io.InputStream inputStream, java.lang.String filename)
          Run the script contained in the specified input stream, using the specified filename as the name of the script being executed.
 IRubyObject runInterpreter(Node scriptNode)
           
 IRubyObject runInterpreterBody(Node scriptNode)
          This is used for the "gets" loop, and we bypass 'load' to use an already-prepared, already-pushed scope for the script body.
 IRubyObject runNormally(Node scriptNode)
          Run the specified script without any of the loop-processing wrapper code.
 IRubyObject runNormally(Node scriptNode, boolean unused)
          Deprecated. 
 IRubyObject runScript(Script script)
           
 IRubyObject runWithGetsLoop(Node scriptNode, boolean printing, boolean processLineEnds, boolean split)
          Run the given script with a "while gets; end" loop wrapped around it.
 IRubyObject runWithGetsLoop(Node scriptNode, boolean printing, boolean processLineEnds, boolean split, boolean unused)
          Deprecated. 
 void secure(int level)
           
 void setCurrentDirectory(java.lang.String dir)
           
static void setCurrentInstance(Ruby runtime)
          Deprecated. 
 void setDebug(IRubyObject debug)
          Setter for property isDebug.
 void setDefaultExternalEncoding(org.jcodings.Encoding defaultExternalEncoding)
           
 void setDefaultInternalEncoding(org.jcodings.Encoding defaultInternalEncoding)
           
 void setDefaultMethodMissing(DynamicMethod method)
           
 void setDoNotReverseLookupEnabled(boolean b)
           
 void setEtc(RubyModule etcModule)
           
 void setGlobalAbortOnExceptionEnabled(boolean enable)
           
 void setGlobalVariables(GlobalVariables globalVariables)
           
 void setJRubyHome(java.lang.String home)
           
 void setKCode(KCode kcode)
           
 void setNormalMethodMissing(DynamicMethod method)
           
 void setPrivateMethodMissing(DynamicMethod method)
           
 void setProtectedMethodMissing(DynamicMethod method)
           
 void setRandomSeed(long randomSeed)
           
 void setRecordSeparatorVar(GlobalVariable recordSeparatorVar)
           
 void setRespondToMethod(java.lang.Object rtm)
           
 void setSafeLevel(int safeLevel)
          Set the current safe level: 0 - strings from streams/environment/ARGV are tainted (default) 1 - no dangerous operation by tainted value 2 - process/file operations prohibited 3 - all generated objects are tainted 4 - no global (non-tainted) variable modification/no direct output The safe level is set using $SAFE in Ruby code.
static void setSecurityRestricted(boolean restricted)
           
 void setStackTraces(int stackTraces)
           
 void setSuperMethodMissing(DynamicMethod method)
           
 void setTraceFunction(RubyProc traceFunction)
           
 void setVariableMethodMissing(DynamicMethod method)
           
 void setVerbose(IRubyObject verbose)
          Setter for property isVerbose.
 void tearDown()
          Make sure Kernel#at_exit procs get invoked on runtime shutdown.
 Script tryCompile(Node node)
           
 void unregisterDescriptor(int aFileno)
           
 void unregisterInspecting(java.lang.Object obj)
           
 void useAsGlobalRuntime()
          Convenience method for java integrators who may need to switch the notion of "global" runtime.
 boolean warningsEnabled()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NIL_PREFILLED_ARRAY_SIZE

public static final int NIL_PREFILLED_ARRAY_SIZE
See Also:
Constant Field Values

fixnumCache

public final RubyFixnum[] fixnumCache
Method Detail

newInstance

public static Ruby newInstance()
Returns a new instance of the JRuby runtime configured with defaults.

Returns:
the JRuby runtime
See Also:
RubyInstanceConfig

newInstance

public static Ruby newInstance(RubyInstanceConfig config)
Returns a new instance of the JRuby runtime configured as specified.

Parameters:
config - The instance configuration
Returns:
The JRuby runtime
See Also:
RubyInstanceConfig

newInstance

public static Ruby newInstance(java.io.InputStream in,
                               java.io.PrintStream out,
                               java.io.PrintStream err)
Returns a new instance of the JRuby runtime configured with the given input, output and error streams and otherwise default configuration (except where specified system properties alter defaults).

Parameters:
in - the custom input stream
out - the custom output stream
err - the custom error stream
Returns:
the JRuby runtime
See Also:
RubyInstanceConfig

getGlobalRuntime

public static Ruby getGlobalRuntime()

useAsGlobalRuntime

public void useAsGlobalRuntime()
Convenience method for java integrators who may need to switch the notion of "global" runtime. Use JRuby.runtime.use_as_global_runtime from Ruby code to activate the current runtime as the global one.


evalScriptlet

public IRubyObject evalScriptlet(java.lang.String script)
Evaluates a script under the current scope (perhaps the top-level scope) and returns the result (generally the last value calculated). This version goes straight into the interpreter, bypassing compilation and runtime preparation typical to normal script runs.

Parameters:
script - The scriptlet to run

evalScriptlet

public IRubyObject evalScriptlet(java.lang.String script,
                                 DynamicScope scope)
Evaluates a script under the current scope (perhaps the top-level scope) and returns the result (generally the last value calculated). This version goes straight into the interpreter, bypassing compilation and runtime preparation typical to normal script runs. This version accepts a scope to use, so you can eval many times against the same scope.

Parameters:
script - The scriptlet to run
scope - The scope to execute against (ManyVarsDynamicScope is recommended, so it can grow as needed)

executeScript

public IRubyObject executeScript(java.lang.String script,
                                 java.lang.String filename)
Parse and execute the specified script This differs from the other methods in that it accepts a string-based script and parses and runs it as though it were loaded at a command-line. This is the preferred way to start up a new script when calling directly into the Ruby object (which is generally *dis*couraged.

Parameters:
script - The contents of the script to run as a normal, root script
Returns:
The last value of the script

runFromMain

public void runFromMain(java.io.InputStream inputStream,
                        java.lang.String filename)
Run the script contained in the specified input stream, using the specified filename as the name of the script being executed. The stream will be read fully before being parsed and executed. The given filename will be used for the ruby $PROGRAM_NAME and $0 global variables in this runtime. This method is intended to be called once per runtime, generally from Main or from main-like top-level entry points. As part of executing the script loaded from the input stream, various RubyInstanceConfig properties will be used to determine whether to compile the script before execution or run with various wrappers (for looping, printing, and so on, see jruby -help).

Parameters:
inputStream - The InputStream from which to read the script contents
filename - The filename to use when parsing, and for $PROGRAM_NAME and $0 ruby global variables.

parseFromMain

public Node parseFromMain(java.io.InputStream inputStream,
                          java.lang.String filename)
Parse the script contained in the given input stream, using the given filename as the name of the script, and return the root Node. This is used to verify that the script syntax is valid, for jruby -c. The current scope (generally the top-level scope) is used as the parent scope for parsing.

Parameters:
inputStream - The input stream from which to read the script
filename - The filename to use for parsing

runWithGetsLoop

@Deprecated
public IRubyObject runWithGetsLoop(Node scriptNode,
                                              boolean printing,
                                              boolean processLineEnds,
                                              boolean split,
                                              boolean unused)
Deprecated. 

Run the given script with a "while gets; end" loop wrapped around it. This is primarily used for the -n command-line flag, to allow writing a short script that processes input lines using the specified code.

Parameters:
scriptNode - The root node of the script to execute
printing - Whether $_ should be printed after each loop (as in the -p command-line flag)
processLineEnds - Whether line endings should be processed by setting $\ to $/ and chop!ing every line read
split - Whether to split each line read using String#split bytecode before executing.
Returns:
The result of executing the specified script

runWithGetsLoop

public IRubyObject runWithGetsLoop(Node scriptNode,
                                   boolean printing,
                                   boolean processLineEnds,
                                   boolean split)
Run the given script with a "while gets; end" loop wrapped around it. This is primarily used for the -n command-line flag, to allow writing a short script that processes input lines using the specified code.

Parameters:
scriptNode - The root node of the script to execute
printing - Whether $_ should be printed after each loop (as in the -p command-line flag)
processLineEnds - Whether line endings should be processed by setting $\ to $/ and chop!ing every line read
split - Whether to split each line read using String#split bytecode before executing.
Returns:
The result of executing the specified script

runNormally

@Deprecated
public IRubyObject runNormally(Node scriptNode,
                                          boolean unused)
Deprecated. 

Run the specified script without any of the loop-processing wrapper code.

Parameters:
scriptNode - The root node of the script to be executed bytecode before execution
Returns:
The result of executing the script

runNormally

public IRubyObject runNormally(Node scriptNode)
Run the specified script without any of the loop-processing wrapper code.

Parameters:
scriptNode - The root node of the script to be executed bytecode before execution
Returns:
The result of executing the script

tryCompile

public Script tryCompile(Node node)

runScript

public IRubyObject runScript(Script script)

runInterpreter

public IRubyObject runInterpreter(Node scriptNode)

runInterpreterBody

public IRubyObject runInterpreterBody(Node scriptNode)
This is used for the "gets" loop, and we bypass 'load' to use an already-prepared, already-pushed scope for the script body.


getParser

public Parser getParser()

getBeanManager

public BeanManager getBeanManager()

getJITCompiler

public JITCompiler getJITCompiler()

getDefaultInstance

public static Ruby getDefaultInstance()
Deprecated. use #newInstance()


getCurrentInstance

@Deprecated
public static Ruby getCurrentInstance()
Deprecated. 


setCurrentInstance

@Deprecated
public static void setCurrentInstance(Ruby runtime)
Deprecated. 


allocSymbolId

public int allocSymbolId()

allocModuleId

public int allocModuleId()

getModule

public RubyModule getModule(java.lang.String name)
Retrieve the module with the given name from the Object namespace.

Parameters:
name - The name of the module
Returns:
The module or null if not found

fastGetModule

public RubyModule fastGetModule(java.lang.String internedName)
Retrieve the module with the given name from the Object namespace. The module name must be an interned string, but this method will be faster than the non-interned version.

Parameters:
internedName - The name of the module; must be an interned String
Returns:
The module or null if not found

getClass

public RubyClass getClass(java.lang.String name)
Retrieve the class with the given name from the Object namespace.

Parameters:
name - The name of the class
Returns:
The class

fastGetClass

public RubyClass fastGetClass(java.lang.String internedName)
Retrieve the class with the given name from the Object namespace. The module name must be an interned string, but this method will be faster than the non-interned version.

Parameters:
internedName - the name of the class; must be an interned String!
Returns:

defineClass

public RubyClass defineClass(java.lang.String name,
                             RubyClass superClass,
                             ObjectAllocator allocator)
Define a new class under the Object namespace. Roughly equivalent to rb_define_class in MRI.

Parameters:
name - The name for the new class
superClass - The super class for the new class
allocator - An ObjectAllocator instance that can construct instances of the new class.
Returns:
The new class

defineClass

public RubyClass defineClass(java.lang.String name,
                             RubyClass superClass,
                             ObjectAllocator allocator,
                             CallSite[] callSites)
A variation of defineClass that allows passing in an array of subplementary call sites for improving dynamic invocation performance.

Parameters:
name - The name for the new class
superClass - The super class for the new class
allocator - An ObjectAllocator instance that can construct instances of the new class.
Returns:
The new class

defineClassUnder

public RubyClass defineClassUnder(java.lang.String name,
                                  RubyClass superClass,
                                  ObjectAllocator allocator,
                                  RubyModule parent)
Define a new class with the given name under the given module or class namespace. Roughly equivalent to rb_define_class_under in MRI. If the name specified is already bound, its value will be returned if: * It is a class * No new superclass is being defined

Parameters:
name - The name for the new class
superClass - The super class for the new class
allocator - An ObjectAllocator instance that can construct instances of the new class.
parent - The namespace under which to define the new class
Returns:
The new class

defineClassUnder

public RubyClass defineClassUnder(java.lang.String name,
                                  RubyClass superClass,
                                  ObjectAllocator allocator,
                                  RubyModule parent,
                                  CallSite[] callSites)
A variation of defineClassUnder that allows passing in an array of supplementary call sites to improve dynamic invocation.

Parameters:
name - The name for the new class
superClass - The super class for the new class
allocator - An ObjectAllocator instance that can construct instances of the new class.
parent - The namespace under which to define the new class
callSites - The array of call sites to add
Returns:
The new class

defineModule

public RubyModule defineModule(java.lang.String name)
Define a new module under the Object namespace. Roughly equivalent to rb_define_module in MRI.

Parameters:
name - The name of the new module

defineModuleUnder

public RubyModule defineModuleUnder(java.lang.String name,
                                    RubyModule parent)
Define a new module with the given name under the given module or class namespace. Roughly equivalent to rb_define_module_under in MRI.

Parameters:
name - The name of the new module
parent - The class or module namespace under which to define the module

getOrCreateModule

public RubyModule getOrCreateModule(java.lang.String name)
From Object, retrieve the named module. If it doesn't exist a new module is created.

Parameters:
name - The name of the module

getSafeLevel

public int getSafeLevel()
Retrieve the current safe level.

See Also:
org.jruby.Ruby#setSaveLevel

setSafeLevel

public void setSafeLevel(int safeLevel)
Set the current safe level: 0 - strings from streams/environment/ARGV are tainted (default) 1 - no dangerous operation by tainted value 2 - process/file operations prohibited 3 - all generated objects are tainted 4 - no global (non-tainted) variable modification/no direct output The safe level is set using $SAFE in Ruby code. It is not particularly well supported in JRuby.


getKCode

public KCode getKCode()

setKCode

public void setKCode(KCode kcode)

secure

public void secure(int level)

checkSafeString

public void checkSafeString(IRubyObject object)

defineGlobalConstant

public void defineGlobalConstant(java.lang.String name,
                                 IRubyObject value)
rb_define_global_const


isClassDefined

public boolean isClassDefined(java.lang.String name)

getNilPrefilledArray

public IRubyObject[] getNilPrefilledArray()

getErrno

public RubyClass getErrno(int n)

getRespondToMethod

public java.lang.Object getRespondToMethod()

setRespondToMethod

public void setRespondToMethod(java.lang.Object rtm)

getTopSelf

public IRubyObject getTopSelf()
Getter for property rubyTopSelf.

Returns:
Value of property rubyTopSelf.

setCurrentDirectory

public void setCurrentDirectory(java.lang.String dir)

getCurrentDirectory

public java.lang.String getCurrentDirectory()

getEtc

public RubyModule getEtc()

setEtc

public void setEtc(RubyModule etcModule)

getObject

public RubyClass getObject()

getBasicObject

public RubyClass getBasicObject()

getModule

public RubyClass getModule()

getClassClass

public RubyClass getClassClass()

getKernel

public RubyModule getKernel()

getPrivateMethodMissing

public DynamicMethod getPrivateMethodMissing()

setPrivateMethodMissing

public void setPrivateMethodMissing(DynamicMethod method)

getProtectedMethodMissing

public DynamicMethod getProtectedMethodMissing()

setProtectedMethodMissing

public void setProtectedMethodMissing(DynamicMethod method)

getVariableMethodMissing

public DynamicMethod getVariableMethodMissing()

setVariableMethodMissing

public void setVariableMethodMissing(DynamicMethod method)

getSuperMethodMissing

public DynamicMethod getSuperMethodMissing()

setSuperMethodMissing

public void setSuperMethodMissing(DynamicMethod method)

getNormalMethodMissing

public DynamicMethod getNormalMethodMissing()

setNormalMethodMissing

public void setNormalMethodMissing(DynamicMethod method)

getDefaultMethodMissing

public DynamicMethod getDefaultMethodMissing()

setDefaultMethodMissing

public void setDefaultMethodMissing(DynamicMethod method)

getDummy

public RubyClass getDummy()

getComparable

public RubyModule getComparable()

getNumeric

public RubyClass getNumeric()

getFloat

public RubyClass getFloat()

getInteger

public RubyClass getInteger()

getFixnum

public RubyClass getFixnum()

getComplex

public RubyClass getComplex()

getRational

public RubyClass getRational()

getEnumerable

public RubyModule getEnumerable()

getEnumerator

public RubyClass getEnumerator()

getYielder

public RubyClass getYielder()

getString

public RubyClass getString()

getEncoding

public RubyClass getEncoding()

getConverter

public RubyClass getConverter()

getSymbol

public RubyClass getSymbol()

getArray

public RubyClass getArray()

getHash

public RubyClass getHash()

getRange

public RubyClass getRange()

getTrue

public RubyBoolean getTrue()
Returns the "true" instance from the instance pool.

Returns:
The "true" instance.

getFalse

public RubyBoolean getFalse()
Returns the "false" instance from the instance pool.

Returns:
The "false" instance.

getNil

public IRubyObject getNil()
Returns the "nil" singleton instance.

Returns:
"nil"

getSingleNilArray

public IRubyObject[] getSingleNilArray()

getNilClass

public RubyClass getNilClass()

getTrueClass

public RubyClass getTrueClass()

getFalseClass

public RubyClass getFalseClass()

getProc

public RubyClass getProc()

getBinding

public RubyClass getBinding()

getMethod

public RubyClass getMethod()

getUnboundMethod

public RubyClass getUnboundMethod()

getMatchData

public RubyClass getMatchData()

getRegexp

public RubyClass getRegexp()

getTime

public RubyClass getTime()

getMath

public RubyModule getMath()

getMarshal

public RubyModule getMarshal()

getBignum

public RubyClass getBignum()

getDir

public RubyClass getDir()

getFile

public RubyClass getFile()

getFileStat

public RubyClass getFileStat()

getFileTest

public RubyModule getFileTest()

getIO

public RubyClass getIO()

getThread

public RubyClass getThread()

getThreadGroup

public RubyClass getThreadGroup()

getDefaultThreadGroup

public RubyThreadGroup getDefaultThreadGroup()

getContinuation

public RubyClass getContinuation()

getStructClass

public RubyClass getStructClass()

getTmsStruct

public IRubyObject getTmsStruct()

getPasswdStruct

public IRubyObject getPasswdStruct()

getGroupStruct

public IRubyObject getGroupStruct()

getGC

public RubyModule getGC()

getObjectSpaceModule

public RubyModule getObjectSpaceModule()

getProcess

public RubyModule getProcess()

getProcStatus

public RubyClass getProcStatus()

getProcUID

public RubyModule getProcUID()

getProcGID

public RubyModule getProcGID()

getProcSysModule

public RubyModule getProcSysModule()

getPrecision

public RubyModule getPrecision()

getErrno

public RubyModule getErrno()

getException

public RubyClass getException()

getNameError

public RubyClass getNameError()

getNameErrorMessage

public RubyClass getNameErrorMessage()

getNoMethodError

public RubyClass getNoMethodError()

getSignalException

public RubyClass getSignalException()

getRangeError

public RubyClass getRangeError()

getSystemExit

public RubyClass getSystemExit()

getLocalJumpError

public RubyClass getLocalJumpError()

getNativeException

public RubyClass getNativeException()

getSystemCallError

public RubyClass getSystemCallError()

getFatal

public RubyClass getFatal()

getInterrupt

public RubyClass getInterrupt()

getTypeError

public RubyClass getTypeError()

getArgumentError

public RubyClass getArgumentError()

getIndexError

public RubyClass getIndexError()

getStopIteration

public RubyClass getStopIteration()

getSyntaxError

public RubyClass getSyntaxError()

getStandardError

public RubyClass getStandardError()

getRuntimeError

public RubyClass getRuntimeError()

getIOError

public RubyClass getIOError()

getLoadError

public RubyClass getLoadError()

getNotImplementedError

public RubyClass getNotImplementedError()

getSecurityError

public RubyClass getSecurityError()

getNoMemoryError

public RubyClass getNoMemoryError()

getRegexpError

public RubyClass getRegexpError()

getEOFError

public RubyClass getEOFError()

getThreadError

public RubyClass getThreadError()

getConcurrencyError

public RubyClass getConcurrencyError()

getSystemStackError

public RubyClass getSystemStackError()

getZeroDivisionError

public RubyClass getZeroDivisionError()

getFloatDomainError

public RubyClass getFloatDomainError()

getEncodingError

public RubyClass getEncodingError()

getEncodingCompatibilityError

public RubyClass getEncodingCompatibilityError()

getCharsetMap

public RubyHash getCharsetMap()

getVerbose

public IRubyObject getVerbose()
Getter for property isVerbose.

Returns:
Value of property isVerbose.

isVerbose

public boolean isVerbose()

warningsEnabled

public boolean warningsEnabled()

setVerbose

public void setVerbose(IRubyObject verbose)
Setter for property isVerbose.

Parameters:
verbose - New value of property isVerbose.

getDebug

public IRubyObject getDebug()
Getter for property isDebug.

Returns:
Value of property isDebug.

setDebug

public void setDebug(IRubyObject debug)
Setter for property isDebug.

Parameters:
debug - New value of property isDebug.

getJavaSupport

public JavaSupport getJavaSupport()

getClassLoader

public static java.lang.ClassLoader getClassLoader()

getJRubyClassLoader

public JRubyClassLoader getJRubyClassLoader()

defineVariable

public void defineVariable(GlobalVariable variable)
Defines a global variable


defineReadonlyVariable

public void defineReadonlyVariable(java.lang.String name,
                                   IRubyObject value)
defines a readonly global variable


parseFile

public Node parseFile(java.io.InputStream in,
                      java.lang.String file,
                      DynamicScope scope,
                      int lineNumber)

parseFile

public Node parseFile(java.io.InputStream in,
                      java.lang.String file,
                      DynamicScope scope)

parseInline

public Node parseInline(java.io.InputStream in,
                        java.lang.String file,
                        DynamicScope scope)

parseEval

public Node parseEval(java.lang.String content,
                      java.lang.String file,
                      DynamicScope scope,
                      int lineNumber)

parse

@Deprecated
public Node parse(java.lang.String content,
                             java.lang.String file,
                             DynamicScope scope,
                             int lineNumber,
                             boolean extraPositionInformation)
Deprecated. 


parseEval

public Node parseEval(org.jruby.util.ByteList content,
                      java.lang.String file,
                      DynamicScope scope,
                      int lineNumber)

parse

public Node parse(org.jruby.util.ByteList content,
                  java.lang.String file,
                  DynamicScope scope,
                  int lineNumber,
                  boolean extraPositionInformation)

getThreadService

public ThreadService getThreadService()

getCurrentContext

public ThreadContext getCurrentContext()

getLoadService

public LoadService getLoadService()
Returns the loadService.

Returns:
ILoadService

getDefaultInternalEncoding

public org.jcodings.Encoding getDefaultInternalEncoding()

setDefaultInternalEncoding

public void setDefaultInternalEncoding(org.jcodings.Encoding defaultInternalEncoding)

getDefaultExternalEncoding

public org.jcodings.Encoding getDefaultExternalEncoding()

setDefaultExternalEncoding

public void setDefaultExternalEncoding(org.jcodings.Encoding defaultExternalEncoding)

getEncodingService

public EncodingService getEncodingService()

getWarnings

public RubyWarnings getWarnings()

getErrorStream

public java.io.PrintStream getErrorStream()

getInputStream

public java.io.InputStream getInputStream()

getOutputStream

public java.io.PrintStream getOutputStream()

getClassFromPath

public RubyModule getClassFromPath(java.lang.String path)

printError

public void printError(RubyException excp)
Prints an error with backtrace to the error stream. MRI: eval.c - error_print()


loadFile

public void loadFile(java.lang.String scriptName,
                     java.io.InputStream in,
                     boolean wrap)

compileAndLoadFile

public void compileAndLoadFile(java.lang.String filename,
                               java.io.InputStream in,
                               boolean wrap)

loadScript

public void loadScript(Script script)

addEventHook

public void addEventHook(EventHook hook)

removeEventHook

public void removeEventHook(EventHook hook)

setTraceFunction

public void setTraceFunction(RubyProc traceFunction)

callEventHooks

public void callEventHooks(ThreadContext context,
                           RubyEvent event,
                           java.lang.String file,
                           int line,
                           java.lang.String name,
                           IRubyObject type)

hasEventHooks

public boolean hasEventHooks()

getGlobalVariables

public GlobalVariables getGlobalVariables()

setGlobalVariables

public void setGlobalVariables(GlobalVariables globalVariables)

callbackFactory

public CallbackFactory callbackFactory(java.lang.Class<?> type)

pushExitBlock

public IRubyObject pushExitBlock(RubyProc proc)
Push block onto exit stack. When runtime environment exits these blocks will be evaluated.

Returns:
the element that was pushed onto stack

addInternalFinalizer

public void addInternalFinalizer(Finalizable finalizer)

addFinalizer

public void addFinalizer(Finalizable finalizer)

removeInternalFinalizer

public void removeInternalFinalizer(Finalizable finalizer)

removeFinalizer

public void removeFinalizer(Finalizable finalizer)

tearDown

public void tearDown()
Make sure Kernel#at_exit procs get invoked on runtime shutdown. This method needs to be explicitly called to work properly. I thought about using finalize(), but that did not work and I am not sure the runtime will be at a state to run procs by the time Ruby is going away. This method can contain any other things that need to be cleaned up at shutdown.


newEmptyArray

public RubyArray newEmptyArray()

newArray

public RubyArray newArray()

newArrayLight

public RubyArray newArrayLight()

newArray

public RubyArray newArray(IRubyObject object)

newArray

public RubyArray newArray(IRubyObject car,
                          IRubyObject cdr)

newArray

public RubyArray newArray(IRubyObject... objects)

newArrayNoCopy

public RubyArray newArrayNoCopy(IRubyObject... objects)

newArrayNoCopyLight

public RubyArray newArrayNoCopyLight(IRubyObject... objects)

newArray

public RubyArray newArray(java.util.List<IRubyObject> list)

newArray

public RubyArray newArray(int size)

newBoolean

public RubyBoolean newBoolean(boolean value)

newFileStat

public RubyFileStat newFileStat(java.lang.String filename,
                                boolean lstat)

newFileStat

public RubyFileStat newFileStat(java.io.FileDescriptor descriptor)

newFixnum

public RubyFixnum newFixnum(long value)

newFixnum

public RubyFixnum newFixnum(int value)

newFixnum

public RubyFixnum newFixnum(com.kenai.constantine.Constant value)

newFloat

public RubyFloat newFloat(double value)

newNumeric

public RubyNumeric newNumeric()

newProc

public RubyProc newProc(Block.Type type,
                        Block block)

newBlockPassProc

public RubyProc newBlockPassProc(Block.Type type,
                                 Block block)

newBinding

public RubyBinding newBinding()

newBinding

public RubyBinding newBinding(Binding binding)

newString

public RubyString newString()

newString

public RubyString newString(java.lang.String string)

newString

public RubyString newString(org.jruby.util.ByteList byteList)

newStringShared

@Deprecated
public RubyString newStringShared(org.jruby.util.ByteList byteList)
Deprecated. 


newSymbol

public RubySymbol newSymbol(java.lang.String name)

fastNewSymbol

public RubySymbol fastNewSymbol(java.lang.String internedName)
Faster than newSymbol(String) if you already have an interned name String. Don't intern your string just to call this version - the overhead of interning will more than wipe out any benefit from the faster lookup.

Parameters:
internedName - the symbol name, must be interned! if in doubt, call newSymbol(String) instead.
Returns:
the symbol for name

newTime

public RubyTime newTime(long milliseconds)

newRuntimeError

public RaiseException newRuntimeError(java.lang.String message)

newArgumentError

public RaiseException newArgumentError(java.lang.String message)

newArgumentError

public RaiseException newArgumentError(int got,
                                       int expected)

newErrnoEBADFError

public RaiseException newErrnoEBADFError()

newErrnoENOPROTOOPTError

public RaiseException newErrnoENOPROTOOPTError()

newErrnoEPIPEError

public RaiseException newErrnoEPIPEError()

newErrnoECONNREFUSEDError

public RaiseException newErrnoECONNREFUSEDError()

newErrnoECONNRESETError

public RaiseException newErrnoECONNRESETError()

newErrnoEADDRINUSEError

public RaiseException newErrnoEADDRINUSEError()

newErrnoEINVALError

public RaiseException newErrnoEINVALError()

newErrnoENOENTError

public RaiseException newErrnoENOENTError()

newErrnoEACCESError

public RaiseException newErrnoEACCESError(java.lang.String message)

newErrnoEAGAINError

public RaiseException newErrnoEAGAINError(java.lang.String message)

newErrnoEISDirError

public RaiseException newErrnoEISDirError(java.lang.String message)

newErrnoEISDirError

public RaiseException newErrnoEISDirError()

newErrnoESPIPEError

public RaiseException newErrnoESPIPEError()

newErrnoEBADFError

public RaiseException newErrnoEBADFError(java.lang.String message)

newErrnoEINVALError

public RaiseException newErrnoEINVALError(java.lang.String message)

newErrnoENOTDIRError

public RaiseException newErrnoENOTDIRError(java.lang.String message)

newErrnoENOTSOCKError

public RaiseException newErrnoENOTSOCKError(java.lang.String message)

newErrnoENOENTError

public RaiseException newErrnoENOENTError(java.lang.String message)

newErrnoESPIPEError

public RaiseException newErrnoESPIPEError(java.lang.String message)

newErrnoEEXISTError

public RaiseException newErrnoEEXISTError(java.lang.String message)

newErrnoEDOMError

public RaiseException newErrnoEDOMError(java.lang.String message)

newErrnoECHILDError

public RaiseException newErrnoECHILDError()

newIndexError

public RaiseException newIndexError(java.lang.String message)

newSecurityError

public RaiseException newSecurityError(java.lang.String message)

newSystemCallError

public RaiseException newSystemCallError(java.lang.String message)

newErrnoFromLastPOSIXErrno

public RaiseException newErrnoFromLastPOSIXErrno()

newTypeError

public RaiseException newTypeError(java.lang.String message)

newThreadError

public RaiseException newThreadError(java.lang.String message)

newConcurrencyError

public RaiseException newConcurrencyError(java.lang.String message)

newSyntaxError

public RaiseException newSyntaxError(java.lang.String message)

newRegexpError

public RaiseException newRegexpError(java.lang.String message)

newRangeError

public RaiseException newRangeError(java.lang.String message)

newNotImplementedError

public RaiseException newNotImplementedError(java.lang.String message)

newInvalidEncoding

public RaiseException newInvalidEncoding(java.lang.String message)

newNoMethodError

public RaiseException newNoMethodError(java.lang.String message,
                                       java.lang.String name,
                                       IRubyObject args)

newNameError

public RaiseException newNameError(java.lang.String message,
                                   java.lang.String name)

newNameError

public RaiseException newNameError(java.lang.String message,
                                   java.lang.String name,
                                   java.lang.Throwable origException)

newNameError

public RaiseException newNameError(java.lang.String message,
                                   java.lang.String name,
                                   java.lang.Throwable origException,
                                   boolean printWhenVerbose)

newLocalJumpError

public RaiseException newLocalJumpError(RubyLocalJumpError.Reason reason,
                                        IRubyObject exitValue,
                                        java.lang.String message)

newLocalJumpErrorNoBlock

public RaiseException newLocalJumpErrorNoBlock()

newRedoLocalJumpError

public RaiseException newRedoLocalJumpError()

newLoadError

public RaiseException newLoadError(java.lang.String message)

newFrozenError

public RaiseException newFrozenError(java.lang.String objectType)

newSystemStackError

public RaiseException newSystemStackError(java.lang.String message)

newSystemStackError

public RaiseException newSystemStackError(java.lang.String message,
                                          java.lang.StackOverflowError soe)

newSystemExit

public RaiseException newSystemExit(int status)

newIOError

public RaiseException newIOError(java.lang.String message)

newStandardError

public RaiseException newStandardError(java.lang.String message)

newIOErrorFromException

public RaiseException newIOErrorFromException(java.io.IOException ioe)

newTypeError

public RaiseException newTypeError(IRubyObject receivedObject,
                                   RubyClass expectedType)

newEOFError

public RaiseException newEOFError()

newEOFError

public RaiseException newEOFError(java.lang.String message)

newZeroDivisionError

public RaiseException newZeroDivisionError()

newFloatDomainError

public RaiseException newFloatDomainError(java.lang.String message)

newEncodingError

public RaiseException newEncodingError(java.lang.String message)

newEncodingCompatibilityError

public RaiseException newEncodingCompatibilityError(java.lang.String message)

newData

public RubyObject.Data newData(RubyClass objectClass,
                               java.lang.Object sval)

getSymbolTable

public RubySymbol.SymbolTable getSymbolTable()

setStackTraces

public void setStackTraces(int stackTraces)

getStackTraces

public int getStackTraces()

setRandomSeed

public void setRandomSeed(long randomSeed)

getRandomSeed

public long getRandomSeed()

getRandom

public java.util.Random getRandom()

getObjectSpace

public ObjectSpace getObjectSpace()

getDescriptors

public java.util.Map<java.lang.Integer,org.jruby.Ruby.WeakDescriptorReference> getDescriptors()

registerDescriptor

public void registerDescriptor(ChannelDescriptor descriptor,
                               boolean isRetained)

registerDescriptor

public void registerDescriptor(ChannelDescriptor descriptor)

unregisterDescriptor

public void unregisterDescriptor(int aFileno)

getDescriptorByFileno

public ChannelDescriptor getDescriptorByFileno(int aFileno)

incrementRandomSeedSequence

public long incrementRandomSeedSequence()

getIn

public java.io.InputStream getIn()

getOut

public java.io.PrintStream getOut()

getErr

public java.io.PrintStream getErr()

isGlobalAbortOnExceptionEnabled

public boolean isGlobalAbortOnExceptionEnabled()

setGlobalAbortOnExceptionEnabled

public void setGlobalAbortOnExceptionEnabled(boolean enable)

isDoNotReverseLookupEnabled

public boolean isDoNotReverseLookupEnabled()

setDoNotReverseLookupEnabled

public void setDoNotReverseLookupEnabled(boolean b)

registerInspecting

public void registerInspecting(java.lang.Object obj)

isInspecting

public boolean isInspecting(java.lang.Object obj)

unregisterInspecting

public void unregisterInspecting(java.lang.Object obj)

isObjectSpaceEnabled

public boolean isObjectSpaceEnabled()

getStartTime

public long getStartTime()

getProfile

public Profile getProfile()

getJRubyHome

public java.lang.String getJRubyHome()

setJRubyHome

public void setJRubyHome(java.lang.String home)

getInstanceConfig

public RubyInstanceConfig getInstanceConfig()

is1_9

public boolean is1_9()

getGlobalState

public long getGlobalState()
GET_VM_STATE_VERSION


incGlobalState

public void incGlobalState()
INC_VM_STATE_VERSION


isSecurityRestricted

public static boolean isSecurityRestricted()

setSecurityRestricted

public static void setSecurityRestricted(boolean restricted)

getPosix

public org.jruby.ext.posix.POSIX getPosix()

setRecordSeparatorVar

public void setRecordSeparatorVar(GlobalVariable recordSeparatorVar)

getRecordSeparatorVar

public GlobalVariable getRecordSeparatorVar()

getJittedMethods

public java.util.Set<Script> getJittedMethods()

getExecutor

public java.util.concurrent.ExecutorService getExecutor()

getTimezoneCache

public java.util.Map<java.lang.String,org.joda.time.DateTimeZone> getTimezoneCache()

getConstantGeneration

public int getConstantGeneration()

incrementConstantGeneration

public void incrementConstantGeneration()

loadConstantSet

public <E extends java.lang.Enum<E>> void loadConstantSet(RubyModule module,
                                                          java.lang.Class<E> enumClass)

loadConstantSet

public void loadConstantSet(RubyModule module,
                            java.lang.String constantSetName)

getNextDynamicMethodSerial

public long getNextDynamicMethodSerial()
Get a new serial number for a new DynamicMethod instance

Returns:
a new serial number

getHierarchyLock

public java.lang.Object getHierarchyLock()
Get the global object used to synchronize class-hierarchy modifications like cache invalidation, subclass sets, and included hierarchy sets.

Returns:
The object to use for locking when modifying the hierarchy


Copyright © 2002-2009 JRuby Team. All Rights Reserved.