Save This Page
Home » jruby-src-1.1.3 » org.jruby » [javadoc | source]
org.jruby
public final class: Ruby [javadoc | source]
java.lang.Object
   org.jruby.Ruby
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:
public static class  Ruby.DaemonThreadFactory  A ThreadFactory for when we're using pooled threads; we want to create the threads with daemon = true so they don't keep us from shutting down. 
public class  Ruby.CallTraceFuncHook   
Field Summary
public final  RubyFixnum[] fixnumCache     
Method from org.jruby.Ruby Summary:
addEventHook,   addFinalizer,   addInternalFinalizer,   allocModuleId,   allocSymbolId,   callEventHooks,   callbackFactory,   checkSafeString,   compileAndLoadFile,   defineClass,   defineClassUnder,   defineGlobalConstant,   defineModule,   defineModuleUnder,   defineReadonlyVariable,   defineVariable,   evalScriptlet,   executeScript,   fastGetClass,   fastGetModule,   fastNewSymbol,   getArgumentError,   getArray,   getBeanManager,   getBignum,   getBinding,   getCacheMap,   getCharsetMap,   getClass,   getClassClass,   getClassFromPath,   getClassLoader,   getComparable,   getContinuation,   getCurrentContext,   getCurrentDirectory,   getCurrentInstance,   getDebug,   getDefaultInstance,   getDefaultThreadGroup,   getDescriptors,   getDir,   getDummy,   getEOFError,   getEnumerable,   getErr,   getErrno,   getErrno,   getErrorStream,   getEtc,   getException,   getExecutor,   getFalse,   getFalseClass,   getFatal,   getFile,   getFileStat,   getFileTest,   getFixnum,   getFloat,   getFloatDomainError,   getGC,   getGlobalState,   getGlobalVariables,   getGroupStruct,   getHash,   getIO,   getIOError,   getIn,   getIndexError,   getInputStream,   getInstanceConfig,   getInteger,   getInterrupt,   getJITCompiler,   getJRubyClassLoader,   getJRubyHome,   getJavaSupport,   getJittedMethods,   getKCode,   getKernel,   getLoadError,   getLoadService,   getLocalJumpError,   getMarshal,   getMatchData,   getMath,   getMethod,   getModule,   getModule,   getNameError,   getNameErrorMessage,   getNativeException,   getNil,   getNilClass,   getNoMemoryError,   getNoMethodError,   getNotImplementedError,   getNumeric,   getObject,   getObjectSpace,   getObjectSpaceModule,   getObjectToYamlMethod,   getOrCreateModule,   getOut,   getOutputStream,   getPasswdStruct,   getPosix,   getPrecision,   getProc,   getProcGID,   getProcStatus,   getProcSysModule,   getProcUID,   getProcess,   getProfile,   getRandom,   getRandomSeed,   getRange,   getRangeError,   getRecordSeparatorVar,   getRegexp,   getRegexpError,   getRespondToMethod,   getRuntimeError,   getSafeLevel,   getSecurityError,   getSignalException,   getStackTraces,   getStandardError,   getStartTime,   getString,   getStructClass,   getSymbol,   getSymbolTable,   getSyntaxError,   getSystemCallError,   getSystemExit,   getSystemStackError,   getThread,   getThreadError,   getThreadGroup,   getThreadService,   getTime,   getTmsStruct,   getTopSelf,   getTrue,   getTrueClass,   getTypeError,   getUnboundMethod,   getVerbose,   getWarnings,   getZeroDivisionError,   hasEventHooks,   incGlobalState,   incrementRandomSeedSequence,   isClassDefined,   isDoNotReverseLookupEnabled,   isGlobalAbortOnExceptionEnabled,   isInspecting,   isObjectSpaceEnabled,   isSecurityRestricted,   loadFile,   loadScript,   newArgumentError,   newArgumentError,   newArray,   newArray,   newArray,   newArray,   newArray,   newArray,   newArrayLight,   newArrayNoCopy,   newArrayNoCopyLight,   newBinding,   newBinding,   newBlockPassProc,   newBoolean,   newEOFError,   newEOFError,   newEmptyArray,   newErrnoEACCESError,   newErrnoEADDRINUSEError,   newErrnoEAGAINError,   newErrnoEBADFError,   newErrnoEBADFError,   newErrnoECHILDError,   newErrnoECONNREFUSEDError,   newErrnoECONNRESETError,   newErrnoEDOMError,   newErrnoEEXISTError,   newErrnoEINVALError,   newErrnoEINVALError,   newErrnoEISDirError,   newErrnoENOENTError,   newErrnoENOENTError,   newErrnoENOPROTOOPTError,   newErrnoENOTDIRError,   newErrnoENOTSOCKError,   newErrnoEPIPEError,   newErrnoESPIPEError,   newErrnoESPIPEError,   newFileStat,   newFileStat,   newFixnum,   newFixnum,   newFloat,   newFloatDomainError,   newFrozenError,   newIOError,   newIOErrorFromException,   newIndexError,   newInstance,   newInstance,   newInstance,   newInvalidEncoding,   newLoadError,   newLocalJumpError,   newNameError,   newNameError,   newNameError,   newNoMethodError,   newNotImplementedError,   newNumeric,   newProc,   newRangeError,   newRedoLocalJumpError,   newRegexpError,   newRuntimeError,   newSecurityError,   newStandardError,   newString,   newString,   newString,   newStringShared,   newSymbol,   newSyntaxError,   newSystemCallError,   newSystemExit,   newSystemStackError,   newThreadError,   newTime,   newTypeError,   newTypeError,   newZeroDivisionError,   parse,   parse,   parseEval,   parseEval,   parseFile,   parseFromMain,   parseInline,   printError,   pushExitBlock,   registerInspecting,   removeEventHook,   removeFinalizer,   removeInternalFinalizer,   runFromMain,   runNormally,   runWithGetsLoop,   secure,   setArray,   setBignum,   setBinding,   setComparable,   setContinuation,   setCurrentDirectory,   setCurrentInstance,   setDebug,   setDefaultThreadGroup,   setDir,   setDoNotReverseLookupEnabled,   setEnumerable,   setEtc,   setException,   setFalseClass,   setFile,   setFileStat,   setFileTest,   setFixnum,   setFloat,   setGC,   setGlobalAbortOnExceptionEnabled,   setGlobalVariables,   setGroupStruct,   setHash,   setIO,   setInteger,   setJRubyHome,   setKCode,   setKernel,   setMarshal,   setMatchData,   setMath,   setMethod,   setNilClass,   setNumeric,   setObjectSpaceEnabled,   setObjectSpaceModule,   setObjectToYamlMethod,   setPasswdStruct,   setPrecision,   setProc,   setProcGID,   setProcStatus,   setProcSys,   setProcUID,   setProcess,   setRandomSeed,   setRange,   setRecordSeparatorVar,   setRegexp,   setRespondToMethod,   setSafeLevel,   setSecurityRestricted,   setStackTraces,   setString,   setStructClass,   setSymbol,   setThread,   setThreadGroup,   setTime,   setTmsStruct,   setTraceFunction,   setTrueClass,   setUnboundMethod,   setVerbose,   tearDown,   unregisterInspecting
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.jruby.Ruby Detail:
 public  void addEventHook(EventHook hook) 
 public  void addFinalizer(Finalizable finalizer) 
 public  void addInternalFinalizer(Finalizable finalizer) 
 public int allocModuleId() 
 public int allocSymbolId() 
 public  void callEventHooks(ThreadContext context,
    int event,
    String file,
    int line,
    String name,
    IRubyObject type) 
 public CallbackFactory callbackFactory(Class type) 
 public  void checkSafeString(IRubyObject object) 
 public  void compileAndLoadFile(String filename,
    InputStream in,
    boolean wrap) 
 public RubyClass defineClass(String name,
    RubyClass superClass,
    ObjectAllocator allocator) 
    Define a new class under the Object namespace. Roughly equivalent to rb_define_class in MRI.
 public RubyClass defineClassUnder(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
 public  void defineGlobalConstant(String name,
    IRubyObject value) 
    rb_define_global_const
 public RubyModule defineModule(String name) 
    Define a new module under the Object namespace. Roughly equivalent to rb_define_module in MRI.
 public RubyModule defineModuleUnder(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.
 public  void defineReadonlyVariable(String name,
    IRubyObject value) 
    defines a readonly global variable
 public  void defineVariable(GlobalVariable variable) 
    Defines a global variable
 public IRubyObject evalScriptlet(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.
 public IRubyObject executeScript(String script,
    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.
 public RubyClass fastGetClass(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.
 public RubyModule fastGetModule(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.
 public RubySymbol fastNewSymbol(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.
 public RubyClass getArgumentError() 
 public RubyClass getArray() 
 public BeanManager getBeanManager() 
 public RubyClass getBignum() 
 public RubyClass getBinding() 
 public CacheMap getCacheMap() 
    Retrieve mappings of cached methods to where they have been cached. When a cached method needs to be invalidated this map can be used to remove all places it has been cached.
 public RubyHash getCharsetMap() 
 public RubyClass getClass(String name) 
    Retrieve the class with the given name from the Object namespace.
 public RubyClass getClassClass() 
 public RubyModule getClassFromPath(String path) 
 public static ClassLoader getClassLoader() 
 public RubyModule getComparable() 
 public RubyClass getContinuation() 
 public ThreadContext getCurrentContext() 
 public String getCurrentDirectory() 
 public static Ruby getCurrentInstance() 
 public IRubyObject getDebug() 
    Getter for property isDebug.
 public static Ruby getDefaultInstance() 
Deprecated! use - #newInstance()

 public RubyThreadGroup getDefaultThreadGroup() 
 public Map getDescriptors() 
 public RubyClass getDir() 
 public RubyClass getDummy() 
 public RubyClass getEOFError() 
 public RubyModule getEnumerable() 
 public PrintStream getErr() 
 public RubyModule getErrno() 
 public RubyClass getErrno(int n) 
 public PrintStream getErrorStream() 
 public RubyModule getEtc() 
 public RubyClass getException() 
 public ExecutorService getExecutor() 
 public RubyBoolean getFalse() 
    Returns the "false" instance from the instance pool.
 public RubyClass getFalseClass() 
 public RubyClass getFatal() 
 public RubyClass getFile() 
 public RubyClass getFileStat() 
 public RubyModule getFileTest() 
 public RubyClass getFixnum() 
 public RubyClass getFloat() 
 public RubyClass getFloatDomainError() 
 public RubyModule getGC() 
 public long getGlobalState() 
    GET_VM_STATE_VERSION
 public GlobalVariables getGlobalVariables() 
 public IRubyObject getGroupStruct() 
 public RubyClass getHash() 
 public RubyClass getIO() 
 public RubyClass getIOError() 
 public InputStream getIn() 
 public RubyClass getIndexError() 
 public InputStream getInputStream() 
 public RubyInstanceConfig getInstanceConfig() 
 public RubyClass getInteger() 
 public RubyClass getInterrupt() 
 public JITCompiler getJITCompiler() 
 public synchronized JRubyClassLoader getJRubyClassLoader() 
 public String getJRubyHome() 
 public JavaSupport getJavaSupport() 
 public Set getJittedMethods() 
 public KCode getKCode() 
 public RubyModule getKernel() 
 public RubyClass getLoadError() 
 public LoadService getLoadService() 
    Returns the loadService.
 public RubyClass getLocalJumpError() 
 public RubyModule getMarshal() 
 public RubyClass getMatchData() 
 public RubyModule getMath() 
 public RubyClass getMethod() 
 public RubyClass getModule() 
 public RubyModule getModule(String name) 
    Retrieve the module with the given name from the Object namespace.
 public RubyClass getNameError() 
 public RubyClass getNameErrorMessage() 
 public RubyClass getNativeException() 
 public IRubyObject getNil() 
    Returns the "nil" singleton instance.
 public RubyClass getNilClass() 
 public RubyClass getNoMemoryError() 
 public RubyClass getNoMethodError() 
 public RubyClass getNotImplementedError() 
 public RubyClass getNumeric() 
 public RubyClass getObject() 
 public ObjectSpace getObjectSpace() 
 public RubyModule getObjectSpaceModule() 
 public Object getObjectToYamlMethod() 
 public RubyModule getOrCreateModule(String name) 
    From Object, retrieve the named module. If it doesn't exist a new module is created.
 public PrintStream getOut() 
 public PrintStream getOutputStream() 
 public IRubyObject getPasswdStruct() 
 public POSIX getPosix() 
 public RubyModule getPrecision() 
 public RubyClass getProc() 
 public RubyModule getProcGID() 
 public RubyClass getProcStatus() 
 public RubyModule getProcSysModule() 
 public RubyModule getProcUID() 
 public RubyModule getProcess() 
 public Profile getProfile() 
 public Random getRandom() 
 public long getRandomSeed() 
 public RubyClass getRange() 
 public RubyClass getRangeError() 
 public GlobalVariable getRecordSeparatorVar() 
 public RubyClass getRegexp() 
 public RubyClass getRegexpError() 
 Object getRespondToMethod() 
 public RubyClass getRuntimeError() 
 public int getSafeLevel() 
    Retrieve the current safe level.
 public RubyClass getSecurityError() 
 public RubyClass getSignalException() 
 public int getStackTraces() 
 public RubyClass getStandardError() 
 public long getStartTime() 
 public RubyClass getString() 
 public RubyClass getStructClass() 
 public RubyClass getSymbol() 
 public RubySymbol.SymbolTable getSymbolTable() 
 public RubyClass getSyntaxError() 
 public RubyClass getSystemCallError() 
 public RubyClass getSystemExit() 
 public RubyClass getSystemStackError() 
 public RubyClass getThread() 
 public RubyClass getThreadError() 
 public RubyClass getThreadGroup() 
 public ThreadService getThreadService() 
 public RubyClass getTime() 
 public IRubyObject getTmsStruct() 
 public IRubyObject getTopSelf() 
    Getter for property rubyTopSelf.
 public RubyBoolean getTrue() 
    Returns the "true" instance from the instance pool.
 public RubyClass getTrueClass() 
 public RubyClass getTypeError() 
 public RubyClass getUnboundMethod() 
 public IRubyObject getVerbose() 
    Getter for property isVerbose.
 public RubyWarnings getWarnings() 
 public RubyClass getZeroDivisionError() 
 public boolean hasEventHooks() 
 public  void incGlobalState() 
    INC_VM_STATE_VERSION
 public long incrementRandomSeedSequence() 
 public boolean isClassDefined(String name) 
 public boolean isDoNotReverseLookupEnabled() 
 public boolean isGlobalAbortOnExceptionEnabled() 
 public boolean isInspecting(Object obj) 
 public boolean isObjectSpaceEnabled() 
 public static boolean isSecurityRestricted() 
 public  void loadFile(String scriptName,
    InputStream in,
    boolean wrap) 
 public  void loadScript(Script script) 
 public RaiseException newArgumentError(String message) 
 public RaiseException newArgumentError(int got,
    int expected) 
 public RubyArray newArray() 
 public RubyArray newArray(IRubyObject object) 
 public RubyArray newArray(IRubyObject[] objects) 
 public RubyArray newArray(List list) 
 public RubyArray newArray(int size) 
 public RubyArray newArray(IRubyObject car,
    IRubyObject cdr) 
 public RubyArray newArrayLight() 
 public RubyArray newArrayNoCopy(IRubyObject[] objects) 
 public RubyArray newArrayNoCopyLight(IRubyObject[] objects) 
 public RubyBinding newBinding() 
 public RubyBinding newBinding(Binding binding) 
 public RubyProc newBlockPassProc(Block.Type type,
    Block block) 
 public RubyBoolean newBoolean(boolean value) 
 public RaiseException newEOFError() 
 public RaiseException newEOFError(String message) 
 public RubyArray newEmptyArray() 
 public RaiseException newErrnoEACCESError(String message) 
 public RaiseException newErrnoEADDRINUSEError() 
 public RaiseException newErrnoEAGAINError(String message) 
 public RaiseException newErrnoEBADFError() 
 public RaiseException newErrnoEBADFError(String message) 
 public RaiseException newErrnoECHILDError() 
 public RaiseException newErrnoECONNREFUSEDError() 
 public RaiseException newErrnoECONNRESETError() 
 public RaiseException newErrnoEDOMError(String message) 
 public RaiseException newErrnoEEXISTError(String message) 
 public RaiseException newErrnoEINVALError() 
 public RaiseException newErrnoEINVALError(String message) 
 public RaiseException newErrnoEISDirError() 
 public RaiseException newErrnoENOENTError() 
 public RaiseException newErrnoENOENTError(String message) 
 public RaiseException newErrnoENOPROTOOPTError() 
 public RaiseException newErrnoENOTDIRError(String message) 
 public RaiseException newErrnoENOTSOCKError(String message) 
 public RaiseException newErrnoEPIPEError() 
 public RaiseException newErrnoESPIPEError() 
 public RaiseException newErrnoESPIPEError(String message) 
 public RubyFileStat newFileStat(FileDescriptor descriptor) 
 public RubyFileStat newFileStat(String filename,
    boolean lstat) 
 public RubyFixnum newFixnum(long value) 
 public RubyFixnum newFixnum(int value) 
 public RubyFloat newFloat(double value) 
 public RaiseException newFloatDomainError(String message) 
 public RaiseException newFrozenError(String objectType) 
 public RaiseException newIOError(String message) 
 public RaiseException newIOErrorFromException(IOException ioe) 
 public RaiseException newIndexError(String message) 
 public static Ruby newInstance() 
    Returns a new instance of the JRuby runtime configured with defaults.
 public static Ruby newInstance(RubyInstanceConfig config) 
    Returns a new instance of the JRuby runtime configured as specified.
 public static Ruby newInstance(InputStream in,
    PrintStream out,
    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).
 public RaiseException newInvalidEncoding(String message) 
 public RaiseException newLoadError(String message) 
 public RaiseException newLocalJumpError(String reason,
    IRubyObject exitValue,