Top Description Inners Fields Constructors Methods
org.jruby

public final Class Ruby

extends Object
implements Constantizable
Class Inheritance
All Implemented Interfaces
org.jruby.compiler.Constantizable
Imports
org.jcodings.specific.UTF8Encoding, org.jruby.anno.TypePopulator, org.jruby.api.Access, .Create, .Define, org.jruby.compiler.Constantizable, .NotCompilableException, .JITCompiler, org.jruby.exceptions.LocalJumpError, .SystemExit, .MainExitException, .RaiseException, org.jruby.ext.jruby.JRubyUtilLibrary, org.jruby.ext.thread.ConditionVariable, .Mutex, .Queue, .SizedQueue, org.jruby.ir.IRScope, .IRScriptBody, .Compiler, .IRManager, org.jruby.ir.runtime.IRReturnJump, org.jruby.java.util.ClassUtils, org.jruby.javasupport.Java, .JavaPackage, .JavaSupport, .JavaSupportImpl, org.jruby.management.Caches, .InlineStats, .BeanManager, .BeanManagerFactory, .Config, org.jruby.parser.ParserManager, .StaticScope, .Parser, .StaticScopeFactory, org.jruby.runtime.JavaSites, .TraceEventManager, .Binding, .Block, .CallSite, .ClassIndex, .DynamicScope, .EventHook, .GlobalVariable, .Helpers, .IAccessor, .ObjectAllocator, .ObjectSpace, .RubyEvent, .ThreadContext, org.jruby.runtime.backtrace.RubyStackTraceElement, org.jruby.runtime.invokedynamic.InvokeDynamicSupport, .MethodNames, org.jruby.specialized.RubyObjectSpecializer, org.jruby.util.JavaNameMangler, .StrptimeParser, .StrptimeToken, .WeakIdentityHashMap, .ByteList, .ClassDefiningClassLoader, .DefinedMessage, .JRubyClassLoader, .SecurityHelper, .SelfFirstJRubyClassLoader, .IOInputStream, .IOOutputStream, .ClassDefiningJRubyClassLoader, .KCode, .SafePropertyAccessor, org.jruby.util.collections.ConcurrentWeakHashMap, org.jruby.util.io.EncodingUtils, .FilenoUtil, .SelectorPool, org.objectweb.asm.util.TraceClassVisitor, jnr.constants.Constant, .ConstantSet, jnr.constants.platform.Errno, jnr.posix.POSIX, .POSIXFactory, org.jcodings.Encoding, org.joda.time.DateTimeZone, org.joni.WarnCallback, org.jruby.ast.Node, .RootNode, org.jruby.ast.executable.RuntimeCache, .Script, .ScriptAndCode, org.jruby.common.RubyWarnings, org.jruby.embed.Extension, org.jruby.ext.JRubyPOSIXHandler, org.jruby.ext.coverage.CoverageData, org.jruby.ext.ffi.FFI, org.jruby.ext.fiber.ThreadFiber, .ThreadFiberLibrary, org.jruby.ext.tracepoint.TracePoint, org.jruby.internal.runtime.GlobalVariables, .ThreadService, .ValueAccessor, org.jruby.internal.runtime.methods.DynamicMethod, org.jruby.ir.interpreter.Interpreter, org.jruby.platform.Platform, org.jruby.runtime.builtin.IRubyObject, org.jruby.runtime.encoding.EncodingService, org.jruby.runtime.load.BasicLibraryService, .CompiledScriptLoader, .LoadService, org.jruby.runtime.opto.Invalidator, .OptoFactory, org.jruby.runtime.profile.ProfileCollection, .ProfilingService, .ProfilingServiceLookup, org.jruby.runtime.scope.ManyVarsDynamicScope, org.jruby.threading.DaemonThreadFactory, org.jruby.util.cli.Options, org.jruby.util.log.Logger, .LoggerFactory, org.objectweb.asm.ClassReader, java.io.ByteArrayInputStream, .ByteArrayOutputStream, .Closeable, .FileDescriptor, .IOException, .InputStream, .PrintStream, .PrintWriter, .Writer, java.lang.invoke.MethodHandle, .VarHandle, java.lang.ref.WeakReference, java.net.BindException, java.nio.ByteBuffer, java.nio.channels.Channels, .WritableByteChannel, java.nio.charset.Charset, .UnsupportedCharsetException, java.security.SecureRandom, java.util.ArrayList, .Collections, .EnumMap, .Enumeration, .HashMap, .IdentityHashMap, .Iterator, .LinkedList, .List, .Map, .Random, .Set, .WeakHashMap, java.util.concurrent.ConcurrentHashMap, .ExecutorService, .SynchronousQueue, .ThreadPoolExecutor, .TimeUnit, java.util.concurrent.atomic.AtomicInteger, .AtomicLong, java.util.concurrent.locks.ReentrantLock, java.util.function.Consumer, .ToIntFunction, java.util.regex.Pattern

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 and Inner Type Summary

Modifier and TypeClass and Description
public static interface
pack-priv static class
Ruby.FStringEqual

Because RubyString.equals does not consider encoding, and MRI's logic for deduplication does need to consider encoding, we use a wrapper object as the key.

public static interface
private class
public static interface

Field Summary

Modifier and TypeField and Description
private boolean
private static final Pattern
private final ConcurrentWeakHashMap<RubyModule, Object>
private volatile IRubyObject
private RubyClass
private final RubyClass
private final RubyClass
private static final VarHandle
private volatile int
private DynamicMethod
baseNewMethod

The built-in Class#new method, so we can bind more directly to allocate and initialize.

private final RubyClass
basicObjectClass

All the core classes we keep hard references to.

private final BeanManager
private final RubyClass
private final Map<String, Map<String, String>>
private RubyClass
private RubyClass
private RubyClass
private RubyClass
private RubyClass
private final Caches
private static final VarHandle
private volatile int
private final RubyClass
private RubyThread
private RubyStackTraceElement
private final Invalidator
private final RubyClass
private final RubyClass
private final RubyModule
private final RubyClass
private RubyClass
private final RubyClass
pack-priv final RubyInstanceConfig
private final Config
private final Object
constant

A representation of this runtime as a JIT-optimizable constant.

private final ConcurrentHashMap<String, Invalidator>
private final RubyClass
private final RubyClass
private RubyClass
private final boolean
private static final VarHandle
private volatile CoverageData
private volatile String
private volatile int
private final RubyClass
private RubyClass
private boolean
private final ThreadLocal<Ruby.FStringEqual>
private final Map<Ruby.FStringEqual, WeakReference<RubyString.FString>>
dedupMap

A map from Ruby string data to a pre-frozen global version of that string.

private DynamicMethod
private DynamicMethod
private RubyRandom
defaultRandom

The default Ruby Random object for this runtime

private RubyThreadGroup
private final EnumMap<DefinedMessage, RubyString>
private final RubyClass
private static final Ruby.ObjectSpacer
private boolean
private final RubyClass
private final AtomicLong
private final RubyArray<T extends IRubyObject>
private final RubyString
private static final Ruby.ObjectSpacer
private final RubyClass
private RubyClass
private RubyClass
private final EncodingService
private final RubyModule
private final RubyClass
private final RubyHash
private RubyClass
private PrintStream
public static final String
private RubyModule
private final Map<Integer, RubyClass>
private RubyModule
private static final VarHandle
private final RubyClass
private volatile int
private final ExecutorService
private final List<Ruby.ExitFunction>
exitBlocks

Reserved for userland at_exit logic that runs before internal services start shutting down.

private final RubyClass
private final RubyBoolean
private final RubyString
private RubyClass
private FFI
private final RubyClass
private RubyClass
private final ExecutorService
private final RubyClass
private final FilenoUtil
private final RubyClass
private final RubyModule
private final Map<Finalizable, Object>
finalizers

A list of "external" finalizers (the ones, registered via ObjectSpace), weakly referenced, to be executed on tearDown.

private final ReentrantLock
pack-priv final RubyFixnum[]
private final RubyClass
pack-priv final Object[]
private final RubyClass
private RubyClass
private RubyClass
private final RubyModule
private final RubyClass
private static volatile Ruby
globalRuntime

The "global" runtime.

private final GlobalVariables
private RubyClass
private final RubyClass
private final long
hashSeedK0

The runtime-local seed for hash randomization

private final long
private final Object
private InputStream
private RubyClass
private final InlineStats
private final ThreadLocal<Map<Object, Object>>
private final RubyClass
private final Map<Finalizable, Object>
internalFinalizers

A list of JRuby-internal finalizers, weakly referenced, to be executed on tearDown.

private final ReentrantLock
private final Interpreter
private RubyClass
private RubyClass
private RubyClass
private final RubyClass
private final RubyClass
private RubyClass
private RubyClass
private final IRManager
private final Map<Class<T>, Consumer<RubyModule>>
private JavaSupport
private final JITCompiler
private final JRubyClassLoader
private KCode
private final RubyModule
kernelModule

All the core modules we keep direct references to, for quick access and to ensure they remain available.

private RubyClass
private RubyClass
private final LoadService
private RubyClass
private RubyClass
private static final Logger
LOG

The logger used to log relevant bits.

private final RubyModule
private final RubyClass
private RubyClass
private final RubyModule
private final RubyClass
private static final VarHandle
private final RubyClass
private volatile int
private final AtomicInteger
private final RubyClass
private RubyClass
private RubyClass
private RubyClass
private POSIX
public static final int
private final RubyClass
private final RubyString
private final RubyNil
private final IRubyObject[]
private final RubyString
private RubyClass
private RubyClass
private RubyClass
private RubyClass
private DynamicMethod
private RubyClass
private MethodHandle
nullToNil

The nullToNil filter for this runtime.

private MethodHandle
private final RubyClass
private final RubyClass
private final ObjectSpace
private volatile boolean
private final RubyModule
private final Ruby.ObjectSpacer
private final RubyObjectSpecializer
private IRubyObject
private PrintStream
pack-priv ParserManager
private RubyClass
public final ClassValue<TypePopulator>
private final POSIX
private final List<Ruby.ExitFunction>
postExitBlocks

Registry of shutdown operations that should happen after all user code has been run (e.g. at_exit hooks).

private RubyModule
private DynamicMethod
private final RubyClass
private final RubyModule
private RubyModule
private RubyClass
private RubyModule
private RubyModule
private final RubyClass
private Profile
private final ProfilingServiceLookup
profilingServiceLookup

Used to find the ProfilingService implementation to use.

private DynamicMethod
private final RubyClass
pack-priv final Random
random

The runtime-local random number generator.

private final RubyClass
private final RubyClass
private RubyClass
private final RubyClass
private GlobalVariable
private final RubyClass
private final RubyClass
private RubyClass
private IRubyObject
private RubyClass
private final WarnCallback
private boolean
private DynamicMethod
private DynamicMethod
pack-priv static final String
private static final AtomicInteger
private final Runtime
private final RuntimeCache
private RubyClass
private final boolean
private final int
private RubyClass
private RubyClass
private static volatile boolean
private final SelectorPool
private RubyClass
private final IRubyObject[]
private boolean
public final JavaSites
private final RubyClass
private RubyClass
private final long
private final StaticScopeFactory
public static final String
private RubyClass
private final RubyClass
private final Map<String, List<StrptimeToken>>
private final RubyClass
private DynamicMethod
private final RubyClass
private final AtomicInteger
private final RubySymbol.SymbolTable
private RubyClass
private RubyClass
private RubyClass
private RubyClass
private final RubyClass
private RubyClass
private final RubyClass
private static final ThreadLocal<Ruby>
threadLocalRuntime

The "thread local" runtime.

private ThreadService
private final EnumMap<RubyThread.Status, RubyString>
private final RubyClass
private final Map<String, DateTimeZone>
private RubyClass
private RubyBinding
private final IRubyObject
private final TraceEventManager
private final RubyClass
private final RubyBoolean
private final RubyString
private RubyClass
pack-priv transient RubyString
private final RubyClass
private RubyClass
private RubyClass
private DynamicMethod
private boolean
private IRubyObject
private boolean
private static final VarHandle
private final Set<RubyWarnings.Category>
private volatile int
private final RubyModule
private final RubyWarnings
private boolean
private final RubyClass
private RubyClass

Constructor Summary

AccessConstructor and Description
private
Ruby(RubyInstanceConfig
The configuration to use for the new instance
config
)

Create and initialize a new JRuby runtime.

Method Summary

Modifier and TypeMethod and Description
public void
addBoundMethod(String className, String methodName, String rubyName)

public void
addBoundMethods(String className, String... tuples)

public void
addBoundMethods(int tuplesIndex, String... classNamesAndTuples)

private Invalidator
public synchronized void
addEventHook(EventHook hook)
Deprecated

public void
public void
public void
addModule(RubyModule
the true module to add to the allModules collection
module
)

A collection of all natural Module instances in the system.

pack-priv void
addProfiledMethod(final String
raw name String of the method to be profiled
id
,
final DynamicMethod method)

Add a method, so it can be printed out later.

public void
addToObjectSpace(boolean useObjectSpace, IRubyObject object)

public int
public int
private boolean
private RubyString.FString

Returns:

the deduped version of the fstring
cacheFString
(RubyString.FString
the fstring to dedup if an equivalent does not already exist
candidate
)

Insert the given FString into the deduplicated FString cache, or retrieve the equivalent FString from the cache.

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

public static void
clearGlobalRuntime()

Clear the global runtime.

public void
compileAndLoadFile(String filename, InputStream in, boolean wrap)

public Object
private void
createSysErr(ThreadContext context, int
the error code (will probably use a java exception instead)
i
,
String
of the error to define.
name
)

Creates a system error.

public RubyClass

Returns:

The new class
defineClass
(String
The name for the new class
name
,
RubyClass
The super class for the new class
superClass
,
ObjectAllocator
An ObjectAllocator instance that can construct instances of the new class.
allocator
,
CallSite[] callSites)
Deprecated since 10.0.

A variation of defineClass that allows passing in an array of supplementary call sites for improving dynamic invocation performance.

public RubyClass
defineClass(String name, RubyClass superClass, ObjectAllocator allocator)
Deprecated since 10.0.

public RubyClass

Returns:

The new class
defineClassUnder
(String
The name for the new class
name
,
RubyClass
The super class for the new class
superClass
,
ObjectAllocator
An ObjectAllocator instance that can construct instances of the new class.
allocator
,
RubyModule
The namespace under which to define the new class
parent
)
Deprecated since 10.0.

Define a new class with the given name under the given module or class namespace.

public RubyClass
defineClassUnder(String id, RubyClass superClass, ObjectAllocator allocator, RubyModule parent, CallSite[] callSites)
Deprecated since 10.0.

public RubyClass

Returns:

The new class
defineClassUnder
(ThreadContext
the current thread context
context
,
String
The name for the new class as an ISO-8859_1 String (id-value)
id
,
RubyClass
The super class for the new class
superClass
,
ObjectAllocator
An ObjectAllocator instance that can construct instances of the new class.
allocator
,
RubyModule
The namespace under which to define the new class
parent
,
CallSite[]
The array of call sites to add
callSites
)

A variation of defineClassUnder that allows passing in an array of supplementary call sites to improve dynamic invocation.

public void
public void
defineGlobalConstant(String
the name
name
,
IRubyObject
the value
value
)
Deprecated since 10.0. Use RubyModule#defineConstant(ThreadContext, String, IRubyObject) with a reference to Object.

rb_define_global_const Define a constant on the global namespace (i.e. Object) with the given name and value.

public RubyModule

Returns:

The new module
defineModule
(String
The name of the new module
name
)
Deprecated since 10.0.

Define a new module under the Object namespace.

public RubyModule

Returns:

The new module
defineModuleBootstrap
(String
The name for the new class
name
)

This is only for defining kernel.

public RubyModule
defineModuleUnder(String name, RubyModule parent)
Deprecated since 10.0.

public RubyModule

Returns:

The new module
defineModuleUnder
(ThreadContext context, String
The name of the new module
name
,
RubyModule
The class or module namespace under which to define the module
parent
)

Define a new module with the given name under the given module or class namespace.

public void
defineReadonlyVariable(String name, IRubyObject value, GlobalVariable.Scope scope)

defines a readonly global variable

public void
defineVariable(final GlobalVariable variable, GlobalVariable.Scope scope)

Defines a global variable

private RubyClass
determineSuperClass(ThreadContext context, String id, RubyModule parent, boolean parentIsObject)

private IRubyObject
private boolean
public void
eachModule(Consumer<RubyModule>
the consumer to call for each module
func
)

Walk all natural Module instances in the system.

private byte[]
public IRubyObject

Returns:

The result of the eval
evalScriptlet
(String
The scriptlet to run
script
)

Evaluates a script under the current scope (perhaps the top-level scope) and returns the result (generally the last value calculated).

public IRubyObject

Returns:

The result of the eval
evalScriptlet
(String
The scriptlet to run
script
,
DynamicScope
The scope to execute against (ManyVarsDynamicScope is recommended, so it can grow as needed)
scope
)

Evaluates a script under the current scope (perhaps the top-level scope) and returns the result (generally the last value calculated).

public IRubyObject

Returns:

The last value of the script
executeScript
(String
The contents of the script to run as a normal, root script
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.

public RubyClass
fastGetClass(String
the name of the class; must be an interned String!
internedName
)
Deprecated

Retrieve the class with the given name from the Object namespace.

public RubySymbol

Returns:

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

Faster than newSymbol(String) if you already have an interned name String.

public IRubyObject

Returns:

the value
fetchGlobalConstant
(String
the name
name
)
Deprecated since 10.0.

Fetch a constant from the global namespace (i.e. Object) with the given name.

private RubyClass
private RubyModule
foundExistingModule(ThreadContext context, RubyModule parent, IRubyObject moduleObj, boolean parentIsObject)

public RubyString

Returns:

the deduplicated FString version of the string
freezeAndDedupString
(RubyString
the string to deduplicate if an equivalent does not already exist
string
)

Given a Ruby string, cache a deduplicated FString version of it, or find an existing copy already prepared.

public RubyString

Returns:

the deduplicated FString version of the ByteList
freezeAndDedupString
(ByteList
the ByteList to deduplicate if an equivalent does not already exist
bytes
)

Given a ByteList, cache a deduplicated FString version of it, or find an existing copy already prepared.

public IRubyObject
public RubyClass
public RubyClass
public RubyClass
public int

Returns:

the current backtrace count
getBacktraceCount
()

Get the current backtrace count.

public DynamicMethod

Returns:

the base Class#new method
getBaseNewMethod
()

Get the base Class#new method.

public RubyClass
public BeanManager
public RubyClass
getBignum()
Deprecated since 10.0. Use org.jruby.api.Access#integerClass(ThreadContext) instead.

public RubyClass
public Map<String, Map<String, String>>
public RubyClass
public RubyClass
public RubyClass
public RubyClass
public RubyClass
public List<StrptimeToken>
public Caches

Returns:

the current runtime's Caches management object
getCaches
()

Get the Caches management object.

public int

Returns:

the current backtrace count
getCallerCount
()

Get the current backtrace count.

public RubyClass
public RubyStackTraceElement
public RubyThread
public Invalidator
public RubyClass

Returns:

The class
getClass
(String
The name of the class
name
)
Deprecated since 10.0.

Retrieve the class with the given name from the Object namespace.

public RubyClass
public RubyModule
public RubyModule

Returns:

the module or null when flexible search is false and a constant cannot be found.
getClassFromPath
(final String
the path to be searched.
path
,
RubyClass
exception type to be thrown when it cannot be found.
undefinedExceptionClass
,
boolean
use getConstant vs getConstantAt (former will find inherited constants from parents and fire const_missing).
flexibleSearch
)

Find module from a string (e.g. Foo, Foo::Bar::Car).

public static ClassLoader
public RubyClass
public RubyModule
public RubyClass
public RubyClass
public RubyClass
public Invalidator
public RubyClass
public RubyClass
public RubyClass
public CoverageData
public ThreadContext
public String
public int
public RubyClass
public RubyClass
public IRubyObject

Returns:

$DEBUG value
getDebug
()

public Charset
getDefaultCharset()

Get the default java.nio.charset.Charset for the current default internal encoding.

public Encoding

Returns:

the default encoding used for new Ruby strings
getDefaultEncoding
()

Return the default internal encoding, if set, or UTF-8 by default.

public Encoding
public Encoding
public Encoding

Returns:

null or encoding
getDefaultInternalEncoding
()

This is an internal encoding if actually specified via default_internal= or passed in via -E.

public DynamicMethod
public RubyRandom
public RubyThreadGroup
public RubyString
public RubyClass
public RubyClass
public RubyArray<T extends IRubyObject>
public RubyString
public RubyClass
public RubyClass
public RubyClass
public EncodingService
public RubyModule
public RubyClass
public RubyHash
public RubyClass
public PrintStream
public RubyClass
getErrno(int n)

public RubyModule
public PrintStream
public RubyModule
getEtc()
Deprecated since 10.0.

public RubyClass
public int

Returns:

he current exception count
getExceptionCount
()

Get the current exception count.

public ExecutorService
public RubyBoolean

Returns:

The "false" instance.
getFalse
()

Returns the "false" instance from the instance pool.

public RubyClass
public RubyString
public RubyClass
public FFI
public RubyClass
public RubyClass
public ExecutorService
public RubyClass
public FilenoUtil
public RubyClass
public RubyModule
public RubyClass
public RubyClass
public RubyClass
public RubyClass
public RubyModule
public RubyClass
public static synchronized Ruby

Returns:

the global runtime
getGlobalRuntime
()

Get the global runtime.

public GlobalVariables
public IRubyObject
public RubyClass
public long
public long
public Object

Returns:

The object to use for locking when modifying the hierarchy
getHierarchyLock
()

Get the global object used to synchronize class-hierarchy modifications like cache invalidation, subclass sets, and included hierarchy sets.

public InputStream
public RubyClass
public InlineStats
public InputStream
public RubyInstanceConfig
public RubyClass
public RubyClass
public RubyClass
public RubyClass
public RubyClass
public RubyClass
public RubyClass
public RubyClass
public IRManager
public Map<Class<T>, Consumer<RubyModule>>

Returns:

Class$ -> extension initializer map

Note

Internal API, subject to change!

getJavaExtensionDefinitions
()

public JavaSupport
public JITCompiler
public JRubyClassLoader
public String
public KCode
public RubyModule
public RubyClass
public RubyClass
public LoadService

Returns:

ILoadService
getLoadService
()

Returns the loadService.

public RubyClass
public RubyClass
public RubyModule
public RubyClass
public RubyModule
public RubyClass
public RubyClass
public RubyModule
getModule(String name)
Deprecated since 10.0.

public RubyClass
public RubyClass
public RubyClass
public RubyClass
public RubyClass
public POSIX

Returns:

a native POSIX, or null if native is not supported
getNativePosix
()

Get the native POSIX associated with this runtime.

public long

Returns:

a new serial number
getNextDynamicMethodSerial
()

Get a new serial number for a new DynamicMethod instance

public int

Returns:

a new generation number
getNextModuleGeneration
()

Get a new generation number for a module or class.

public IRubyObject

Returns:

"nil"
getNil
()

Returns the "nil" singleton instance.

public RubyClass
public RubyString
public IRubyObject[]
public RubyString
public RubyClass
public RubyClass
public RubyClass
public DynamicMethod
public RubyClass
public MethodHandle

Returns:

a method handle suitable for filtering a single IRubyObject value from null to nil
getNullToNilHandle
()

Get the "nullToNil" method handle filter for this runtime.

public MethodHandle
public RubyClass
public RubyClass
public ObjectSpace
public RubyModule
public RubyObjectSpecializer
public RubyModule

Returns:

The existing or new module
getOrCreateModule
(String
The name of the module
id
)

From Object, retrieve the named module.

public IRubyObject

Returns:

the original stderr with which this runtime was initialized
getOriginalStderr
()

Return the original stderr with which this runtime was initialized.

public PrintStream
public PrintStream
public Parser
getParser()
Deprecated

public ParserManager
public IRubyObject
public POSIX
public RubyModule
public DynamicMethod
public RubyClass
public RubyModule
public RubyModule
public RubyClass
public RubyModule
public RubyModule
public RubyClass
public Profile
public ProfilingService

Returns:

the, for this ruby instance, configured implementation of ProfilingService, or null
getProfilingService
()

private ProfilingServiceLookup

Returns:

#profilingServiceLookup
getProfilingServiceLookup
()

Simple getter for #profilingServiceLookup to avoid direct property access

public DynamicMethod
public RubyClass
public RubyClass
public RubyClass
public RubyClass
public RubyClass
public GlobalVariable
public RubyClass
public RubyClass
public RubyClass
public RubyClass
pack-priv WarnCallback
public IRubyObject
getReportOnException()
Deprecated

public DynamicMethod
public DynamicMethod
public IRubyObject
public RuntimeCache
getRuntimeCache()

Get the core class RuntimeCache instance, for doing dynamic calls from core class methods.

public RubyClass
public int
public RubyClass
public SelectorPool

Returns:

a SelectorPool from which to getService Selector instances
getSelectorPool
()

Get the runtime-global selector pool

public RubyClass
public IRubyObject[]
public RubyClass
public RubyClass
public long
public StaticScopeFactory
public IRubyObject
public RubyClass
public RubyClass
public RubyClass
public DynamicMethod
public RubyClass
public RubySymbol.SymbolTable
public RubyClass
public RubyClass
public RubyClass
public RubyClass
public RubyClass
public RubyClass
public RubyClass
public static Ruby

Returns:

the thread-local runtime, or null if unset
getThreadLocalRuntime
()

Get the thread-local runtime for the current thread, or null if unset.

public ThreadService
public RubyString
public RubyClass
public Map<String, DateTimeZone>
public IRubyObject
public RubyBinding
public IRubyObject

Returns:

Value of property rubyTopSelf.
getTopSelf
()

Getter for property rubyTopSelf.

public TraceEventManager
public RubyBoolean

Returns:

The "true" instance.
getTrue
()

Returns the "true" instance from the instance pool.

public RubyClass
public RubyString
public RubyClass
public RubyClass
public RubyClass
public RubyClass
public DynamicMethod
public IRubyObject

Returns:

$VERBOSE value
getVerbose
()

public RubyModule
public Set<RubyWarnings.Category>

Returns:

a set of the currently-enabled warning categories
getWarningCategories
()

Get the current enabled warning categories.

public int

Returns:

the current backtrace count
getWarningCount
()

Get the current backtrace count.

public RubyWarnings
public RubyClass
public RubyClass
public boolean
hasEventHooks()
Deprecated

private void
ifAllowed(String name, Consumer<Ruby> callback)

public void
incrementBacktraceCount()

Increment the count of backtraces generated by code in this runtime.

public void
incrementCallerCount()

Increment the count of backtraces generated by code in this runtime.

public void
incrementExceptionCount()

Increment the count of exceptions generated by code in this runtime.

public void
incrementWarningCount()

Increment the count of backtraces generated for warnings in this runtime.

private void
private RubyClass
private void
private void
private void
initErrno(ThreadContext context)

Create module Errno's Variables.

private void
private void
initJavaSupport(ThreadContext context)

Load libraries expected to be present after a normal boot.

private JRubyClassLoader
private Ruby.ObjectSpacer
private void
private Random
private void
private void
private void
private static IRubyObject
inspectFrozenObject(ThreadContext context, Ruby runtime, IRubyObject obj, boolean recur)

public boolean
public boolean
public boolean
public boolean
isClassDefined(String name)
Deprecated since 10.0.

public boolean
public boolean

Returns:

$DEBUG value as a boolean
isDebug
()

public boolean
public boolean
public boolean
public static boolean

Returns:

true if a global runtime is instantiated, false for other.
isGlobalRuntimeReady
()

Tests whether globalRuntime has been instantiated or not.

public boolean
private static boolean
public boolean
public boolean
public static boolean
public boolean
public boolean

Returns:

$VERBOSE value as a Java primitive
isVerbose
()

private void
public <
the enum type, which must implement Constant.
C extends Enum<C> & Constant
>
void
loadConstantSet(RubyModule
the module in which we want to define the constants
module
,
Class<C>
the enum class of the constants to define
enumClass
)

Define all constants from the given jnr-constants enum which are defined on the current platform.

public void
loadConstantSet(RubyModule
the module in which we want to define the constants
module
,
String
the name of the constant set from which to get the constants
constantSetName
)
Deprecated since 10.0.

Define all constants from the named jnr-constants set which are defined on the current platform.

public void
loadExtension(String
The name of the extension, to go on the frame wrapping it
extName
,
BasicLibraryService
The extension object to load
extension
,
boolean
Whether to use a new "self" for toplevel
wrap
)

Load the given BasicLibraryService instance, wrapping it in Ruby framing to ensure it is isolated from any parent scope.

public void
loadFile(String scriptName, InputStream in, boolean wrap)

public JavaSupport
private void
public void
loadScope(IRScope scope, boolean wrap)

public void
public void
loadScript(Script script, boolean wrap)

public RaiseException
public RaiseException
newArgumentError(int got, int expected)

public RaiseException
newArgumentError(int got, int min, int max)

public RaiseException
newArgumentError(String name, int got, int expected)
Deprecated since 10.0.

public RaiseException
newArgumentError(String name, int got, int min, int max)
Deprecated since 10.0.

public RubyArray<T extends IRubyObject>
newArray()
Deprecated since 10.0.

public RubyArray<T extends IRubyObject>
newArray(IRubyObject object)
Deprecated since 10.0.

public RubyArray<T extends IRubyObject>
newArray(IRubyObject car, IRubyObject cdr)
Deprecated since 10.0.

public RubyArray<T extends IRubyObject>
newArray(IRubyObject... objects)
Deprecated since 10.0.

public RubyArray<T extends IRubyObject>
newArray(List<IRubyObject> list)
Deprecated since 10.0.

public RubyArray<T extends IRubyObject>
newArray(int size)
Deprecated since 10.0.

public RubyArray<T extends IRubyObject>
newArrayLight()
Deprecated since 10.0.

public RubyArray<T extends IRubyObject>
newArrayNoCopy(IRubyObject... objects)
Deprecated since 10.0.

public RubyArray<T extends IRubyObject>
newArrayNoCopyLight(IRubyObject... objects)
Deprecated since 10.0.

public RubyBinding
public RubyBinding
public RubyProc
public RubyBoolean
newBoolean(boolean value)

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

public RubyString
public RubyArray<T extends IRubyObject>
newEmptyArray()
Deprecated since 10.0.

public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
newErrnoFromErrno(Errno errno, String message)

public RaiseException
newErrnoFromInt(int errno, String methodName, String message)

public RaiseException
newErrnoFromInt(int errno, String message)

public RaiseException
newErrnoFromInt(int errno)

public RaiseException
public RaiseException
public RubyFileStat
newFileStat(String filename, boolean lstat)

public RubyFileStat
public RubyFixnum
newFixnum(long value)

public RubyFixnum
newFixnum(int value)

public RubyFixnum
public RubyFloat
newFloat(double value)

public RaiseException
public RaiseException
newFrozenError(String objectType, IRubyObject receiver)

public RaiseException
newFrozenError(IRubyObject receiver, String message)
Deprecated since 10.0.

public RaiseException
public RaiseException
newFrozenError(String objectType)
Deprecated

public RaiseException
newFrozenError(RubyModule type)
Deprecated

public RaiseException
newFrozenError(String objectType, boolean runtimeError)
Deprecated

public RaiseException
newIllegalSequence(String message)
Deprecated since 9.4-.

public RaiseException
public static Ruby

Returns:

the JRuby runtime
newInstance
()

Returns a new instance of the JRuby runtime configured with defaults.

public static Ruby

Returns:

The JRuby runtime
newInstance
(RubyInstanceConfig
The instance configuration
config
)

Returns a new instance of the JRuby runtime configured as specified.

public static Ruby

Returns:

the JRuby runtime
newInstance
(InputStream
the custom input stream
in
,
PrintStream
the custom output stream
out
,
PrintStream
the custom error stream
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
public RaiseException
public RaiseException
newInvalidEncoding(String message)
Deprecated since 9.4-.

public RaiseException

Returns:

a fully-prepared IOError throwable
newIOError
(String
the message for the new IOError
message
)

Prepare a throwable IOError with the given message.

public RaiseException
newIOErrorFromException(final IOException ex)

Java does not give us enough information for specific error conditions so we are reduced to divining them through string matches...

public RaiseException
private RaiseException
newLightweightErrnoException(RubyClass exceptionClass, String message)

Generate one of the ERRNO exceptions.

public RaiseException
public RaiseException
newLoadError(String message, String path)

public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException

Returns:

a new NameError
newNameError
(String
an sprintf format string for the message
message
,
IRubyObject
the receiver object
recv
,
IRubyObject
the name that failed
name
,
boolean
whether the failure was due to method visibility
privateCall
)

Construct a NameError that formats its message with an sprintf format string.

public RaiseException
newNameError(String message, IRubyObject recv, String name)

Construct a NameError that formats its message with an sprintf format string.

public RaiseException
newNameError(String message, IRubyObject recv, String name, boolean privateCall)

Construct a NameError that formats its message with an sprintf format string and has private_call?

public RaiseException

Returns:

a new NameError
newNameError
(String
the pre-formatted message for the NameError
message
,
String
the name that failed
name
,
Throwable
the original exception, or null
exception
,
boolean
whether to log this exception when verbose mode is enabled
printWhenVerbose
)

Construct a NameError with the given pre-formatted message, name, and optional original exception.

public RaiseException
newNameError(String message, IRubyObject name, Throwable exception, boolean printWhenVerbose)

public RaiseException

Returns:

a new NameError
newNameError
(String
the pre-formatted message for the error
message
,
String
the name that failed
name
)

Construct a NameError with a pre-formatted message and name.

public RaiseException
public RaiseException

Returns:

a new NameError
newNameError
(String
a formatted string message for the error
message
,
String
the name that failed
name
,
Throwable
the original exception, or null if none
origException
)

Construct a NameError with an optional originating exception and a pre-formatted message.

public RaiseException
newNoMethodError(String message, IRubyObject recv, String name, RubyArray<T extends IRubyObject> args)

public RaiseException

Returns:

a new NoMethodError
newNoMethodError
(String message, IRubyObject recv, String name, RubyArray<T extends IRubyObject> args, boolean privateCall)

Construct a NoMethodError that formats its message with an sprintf format string.

public RaiseException

Returns:

a new NoMethodError
newNoMethodError
(String
the pre-formatted message
message
,
String
the name that failed
name
,
IRubyObject
the original arguments to the call that failed
args
)

Construct a NoMethodError with a pre-formatted message.

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

public RaiseException

Returns:

a new RaiseException wrapping a new Ruby exception
newRaiseException
(RubyClass
the exception class from which to construct the exception object
exceptionClass
,
String
a simple message for the exception
message
)

Construct a new RaiseException wrapping a new Ruby exception object appropriate to the given exception class.

public RaiseException
public RubyRational
newRational(long num, long den)

public RubyRational
newRationalReduced(long num, long den)

public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
public RaiseException
newStopIteration(IRubyObject result, String
the message for the exception
message
)

Generate a StopIteration exception.

public RubyString
public RubyString
newString(String string)

public RubyString
newString(ByteList byteList)

public RubySymbol

Returns:

A Ruby Symbol representing the name/id.
newSymbol
(String
raw bytes to store into the symbol table or use to lookup an existing symbol.
name
)

Create a new Symbol or lookup a symbol from an ISO_8859_1 "id" String.

public RubySymbol
newSymbol(String name, Encoding encoding)

public RubySymbol
public RaiseException
public RaiseException
newSyntaxError(String message, String path)

public RaiseException
public RaiseException
newSystemExit(int status)

public RaiseException
newSystemExit(int status, String message)

public RaiseException
public RaiseException
public RaiseException
public RubyTime
newTime(long milliseconds)

public RaiseException
newTypeError(String message)
Deprecated

public RaiseException
newTypeError(IRubyObject receivedObject, RubyClass expectedType)
Deprecated

public RaiseException
newTypeError(IRubyObject receivedObject, RubyModule expectedType)
Deprecated

public RaiseException
newTypeError(IRubyObject receivedObject, String expectedType)
Deprecated

public RaiseException
public RaiseException
public Node
parse(ByteList content, String file, DynamicScope scope, int lineNumber, boolean extraPositionInformation)
Deprecated

public Node
parseEval(String source, String file, DynamicScope scope, int lineNumber)
Deprecated

public ParseResult
parseEval(ByteList source, String file, DynamicScope scope, int lineNumber)
Deprecated

public Node
parseFile(InputStream in, String file, DynamicScope scope)
Deprecated

public ParseResult
parseFile(String file, InputStream in, DynamicScope scope)
Deprecated

public Node
parseFile(InputStream in, String file, DynamicScope scope, int lineNumber)
Deprecated

public ParseResult
parseFile(String file, InputStream in, DynamicScope scope, int lineNumber)
Deprecated

private Node
parseFileAndGetAST(InputStream in, String file, DynamicScope scope, int lineNumber, boolean isFromMain)
Deprecated

public Node
parseFileFromMain(InputStream in, String file, DynamicScope scope)
Deprecated

public ParseResult
parseFileFromMain(String file, InputStream in, DynamicScope scope)
Deprecated

private Node
public Node

Returns:

The root node of the parsed script
parseFromMain
(InputStream
The input stream from which to read the script
inputStream
,
String
The filename to use for parsing
filename
)
Deprecated

Parse the script contained in the given input stream, using the given filename as the name of the script, and return the root Node.

public ParseResult
public Node
parseInline(InputStream in, String file, DynamicScope scope)
Deprecated

private ScriptAndCode
public void
printError(final RubyException ex)

Prints a Ruby exception with backtrace to the configured stderr stream.

public void
printError(final Throwable ex)

Prints an exception to System.err.

public void
printErrorString(String
the string to print
msg
)

Prints a string directly to the stderr channel, if default, or via dynamic dispatch otherwise.

public void
printErrorString(byte[]
the string to print
msg
)

Prints a string directly to the stderr channel, if default, or via dynamic dispatch otherwise.

public synchronized void
printProfileData(ProfileCollection profileData)

TDOD remove the synchronized.

public void
pushEndBlock(RubyProc proc)

It is possible for looping or repeated execution to encounter the same END block multiple times.

public IRubyObject

Returns:

the element that was pushed onto stack
pushExitBlock
(RubyProc proc)

Push block onto exit stack.

public void
pushExitFunction(Ruby.ExitFunction
the function to be run
func
)

Add an exit function to be run on runtime exit.

public void
pushPostExitFunction(Ruby.ExitFunction
the ExitFunction to run after user exit hooks have completed
postExit
)

Add a post-termination exit function that should be run to shut down JRuby internal services.

public void
public void
pack-priv void
reinitialize(boolean reinitCore)

public void
releaseClassLoader()

By default tearDown(boolean) does not release the class-loader's resources as threads might be still running accessing the classes/packages even after the runtime has been torn down.

public void
public synchronized void
removeEventHook(EventHook hook)
Deprecated

public void
public void
public void
runFromMain(InputStream
The InputStream from which to read the script contents
inputStream
,
String
The filename to use when parsing, and for $PROGRAM_NAME and $0 ruby global variables.
filename
)

Run the script contained in the specified input stream, using the specified filename as the name of the script being executed.

public IRubyObject
public IRubyObject
runInterpreter(ThreadContext context, Node rootNode, IRubyObject self)

public IRubyObject
runInterpreter(Node scriptNode)

public IRubyObject
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.

public IRubyObject

Returns:

The result of executing the script
runNormally
(Node
The root node of the script to be executed bytecode before execution
scriptNode
,
boolean
whether to wrap the execution in an anonymous module
wrap
)
Deprecated

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

public IRubyObject
runNormally(Node scriptNode, IRubyObject self, boolean wrap)
Deprecated

public IRubyObject
runNormally(ParseResult scriptNode, IRubyObject self, boolean wrap)

public IRubyObject

Returns:

The result of executing the script
runNormally
(Node
The root node of the script to be executed bytecode before execution
scriptNode
)
Deprecated

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

public IRubyObject
runScript(Script script)

public IRubyObject
runScript(Script script, boolean wrap)

public IRubyObject
runScript(Script script, IRubyObject self, boolean wrap)

public IRubyObject
runScriptBody(Script script)

This is used for the "gets" loop, and we bypass 'load' to use an already-prepared, already-pushed scope for the script body.

public IRubyObject

Returns:

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

Run the given script with a "while gets; end" loop wrapped around it.

public void
setAbortOnException(final boolean abortOnException)

public void
public void
setBaseNewMethod(DynamicMethod baseNewMethod)

Set the base Class#new method.

public void
public void
public void
setCurrentLine(int line)

public void
public void
setDebug(IRubyObject
the $DEBUG value
debug
)

Setter for property isDebug.

public void
setDebug(final boolean debug)

Sets the $DEBUG flag

public void
setDefaultExternalEncoding(Encoding defaultExternalEncoding)

public void
setDefaultFilesystemEncoding(Encoding defaultFilesystemEncoding)

public void
setDefaultInternalEncoding(Encoding defaultInternalEncoding)

public void
public void
pack-priv void
public void
public void
setENV(RubyHash env)
Deprecated

public void
setEtc(RubyModule etcModule)

public void
setFFI(FFI ffi)

public void
setGlobalAbortOnExceptionEnabled(boolean enable)
Deprecated

private static synchronized void
setGlobalRuntimeFirstTimeOnly(Ruby
the runtime to use for global runtime
runtime
)

Set the global runtime to the given runtime only if it has no been set.

public void
public void
public void
setKCode(KCode kcode)

public void
public void
public void
setObjectSpaceEnabled(boolean objectSpaceEnabled)

pack-priv void
public void
setPasswdStruct(RubyClass passwdStruct)

pack-priv void
setPrecision(RubyModule precisionModule)

public void
pack-priv void
setProcGID(RubyModule procGIDModule)

pack-priv void
setProcStatus(RubyClass procStatusClass)

pack-priv void
setProcSys(RubyModule procSysModule)

pack-priv void
setProcUID(RubyModule procUIDModule)

public void
public void
public void
public void
public void
setReportOnException(boolean enable)

public void
public void
public void
public static void
setSecurityRestricted(boolean restricted)

public void
public static void
setThreadLocalRuntime(Ruby
the new runtime for thread-local
ruby
)

Set the thread-local runtime to the given runtime.

pack-priv void
public void
public void
setTraceFunction(RubyProc traceFunction)
Deprecated

public void
public Encoding
setupSourceEncoding(Encoding defaultEncoding)

public StaticScope
public void
public void
setVerbose(final IRubyObject
the verbose ruby value
verbose
)

Sets the runtime verbosity ($VERBOSE global which usually gets set to nil/false or true).

public void
setVerbose(final Boolean
null, true and false are all valid
verbose
)

Sets the $VERBOSE level

public void
setWarningsEnabled(final boolean warningsEnabled)

Setter that enables/disabled warnings (without changing verbose mode).

private void
public void
tearDown()

Make sure Kernel#at_exit procs getService invoked on runtime shutdown.

public void
tearDown(boolean systemExit)

public Script
tryCompile(Node node)
Deprecated

public Script

Returns:

an instance of the successfully-compiled Script, or null.
tryCompile
(ParseResult
The result to attempt to compiled
result
)

Try to compile the code associated with the given Node, returning an instance of the successfully-compiled Script or null if the script could not be compiled.

private ScriptAndCode
private Script
public void
public void
useAsGlobalRuntime()

Convenience method for java integrators who may need to switch the notion of "global" runtime.

private int
public boolean

Returns:

whether warnings are enabled
warningsEnabled
()

If the user explicitly disabled warnings using: setWarningsEnabled(boolean) return false.

private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait