| Method from org.jruby.Ruby Detail: |
public void addEventHook(EventHook hook) {
eventHooks.add(hook);
hasEventHooks = true;
}
|
public void addFinalizer(Finalizable finalizer) {
synchronized (finalizersMutex) {
if (finalizers == null) {
finalizers = new WeakHashMap< Finalizable, Object >();
}
finalizers.put(finalizer, null);
}
}
|
public void addInternalFinalizer(Finalizable finalizer) {
synchronized (internalFinalizersMutex) {
if (internalFinalizers == null) {
internalFinalizers = new WeakHashMap< Finalizable, Object >();
}
internalFinalizers.put(finalizer, null);
}
}
|
public int allocModuleId() {
return moduleLastId.incrementAndGet();
}
|
public int allocSymbolId() {
return symbolLastId.incrementAndGet();
}
|
public void callEventHooks(ThreadContext context,
int event,
String file,
int line,
String name,
IRubyObject type) {
for (EventHook eventHook : eventHooks) {
if (eventHook.isInterestedInEvent(event)) {
eventHook.event(context, event, file, line, name, type);
}
}
}
|
public CallbackFactory callbackFactory(Class type) {
return CallbackFactory.createFactory(this, type);
}
|
public void checkSafeString(IRubyObject object) {
if (getSafeLevel() > 0 && object.isTaint()) {
ThreadContext tc = getCurrentContext();
if (tc.getFrameName() != null) {
throw newSecurityError("Insecure operation - " + tc.getFrameName());
}
throw newSecurityError("Insecure operation: -r");
}
secure(4);
if (!(object instanceof RubyString)) {
throw newTypeError(
"wrong argument type " + object.getMetaClass().getName() + " (expected String)");
}
}
|
public void compileAndLoadFile(String filename,
InputStream in,
boolean wrap) {
IRubyObject self = null;
if (wrap) {
self = TopSelfFactory.createTopSelf(this);
} else {
self = getTopSelf();
}
ThreadContext context = getCurrentContext();
String file = context.getFile();
try {
secure(4); /* should alter global state */
context.setFile(filename);
context.preNodeEval(objectClass, self, filename);
Node scriptNode = parseFile(in, filename, null);
Script script = tryCompile(scriptNode, new JRubyClassLoader(jrubyClassLoader));
if (script == null) {
System.err.println("Error, could not compile; pass -J-Djruby.jit.logging.verbose=true for more details");
}
runScript(script);
} catch (JumpException.ReturnJump rj) {
return;
} finally {
context.postNodeEval();
context.setFile(file);
}
}
|
public RubyClass defineClass(String name,
RubyClass superClass,
ObjectAllocator allocator) {
return defineClassUnder(name, superClass, allocator, objectClass);
}
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) {
IRubyObject classObj = parent.getConstantAt(name);
if (classObj != null) {
if (!(classObj instanceof RubyClass)) throw newTypeError(name + " is not a class");
RubyClass klazz = (RubyClass)classObj;
if (klazz.getSuperClass().getRealClass() != superClass) {
throw newNameError(name + " is already defined", name);
}
// If we define a class in Ruby, but later want to allow it to be defined in Java,
// the allocator needs to be updated
if (klazz.getAllocator() != allocator) {
klazz.setAllocator(allocator);
}
return klazz;
}
boolean parentIsObject = parent == objectClass;
if (superClass == null) {
String className = parentIsObject ? name : parent.getName() + "::" + name;
warnings.warn(ID.NO_SUPER_CLASS, "no super class for `" + className + "', Object assumed", className);
superClass = objectClass;
}
return RubyClass.newClass(this, superClass, name, allocator, parent, !parentIsObject);
}
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) {
objectClass.defineConstant(name, value);
}
|
public RubyModule defineModule(String name) {
return defineModuleUnder(name, objectClass);
}
Define a new module under the Object namespace. Roughly equivalent to
rb_define_module in MRI. |
public RubyModule defineModuleUnder(String name,
RubyModule parent) {
IRubyObject moduleObj = parent.getConstantAt(name);
boolean parentIsObject = parent == objectClass;
if (moduleObj != null ) {
if (moduleObj.isModule()) return (RubyModule)moduleObj;
if (parentIsObject) {
throw newTypeError(moduleObj.getMetaClass().getName() + " is not a module");
} else {
throw newTypeError(parent.getName() + "::" + moduleObj.getMetaClass().getName() + " is not a module");
}
}
return RubyModule.newModule(this, name, parent, !parentIsObject);
}
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) {
globalVariables.defineReadonly(name, new ValueAccessor(value));
}
defines a readonly global variable |
public void defineVariable(GlobalVariable variable) {
globalVariables.define(variable.name(), new IAccessor() {
public IRubyObject getValue() {
return variable.get();
}
public IRubyObject setValue(IRubyObject newValue) {
return variable.set(newValue);
}
});
}
Defines a global variable |
public IRubyObject evalScriptlet(String script) {
ThreadContext context = getCurrentContext();
Node node = parseEval(script, "< script >", context.getCurrentScope(), 0);
try {
return node.interpret(this, context, context.getFrameSelf(), Block.NULL_BLOCK);
} catch (JumpException.ReturnJump rj) {
throw newLocalJumpError("return", (IRubyObject)rj.getValue(), "unexpected return");
} catch (JumpException.BreakJump bj) {
throw newLocalJumpError("break", (IRubyObject)bj.getValue(), "unexpected break");
} catch (JumpException.RedoJump rj) {
throw newLocalJumpError("redo", (IRubyObject)rj.getValue(), "unexpected redo");
}
}
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) {
byte[] bytes;
try {
bytes = script.getBytes(KCode.NONE.getKCode());
} catch (UnsupportedEncodingException e) {
bytes = script.getBytes();
}
Node node = parseInline(new ByteArrayInputStream(bytes), filename, null);
ThreadContext context = getCurrentContext();
String oldFile = context.getFile();
int oldLine = context.getLine();
try {
context.setFile(node.getPosition().getFile());
context.setLine(node.getPosition().getStartLine());
return runNormally(node, false);
} finally {
context.setFile(oldFile);
context.setLine(oldLine);
}
}
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) {
return objectClass.fastGetClass(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) {
return (RubyModule) objectClass.fastGetConstantAt(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) {
assert internedName == internedName.intern() : internedName + " is not interned";
return symbolTable.fastGetSymbol(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() {
return argumentError;
}
|
public RubyClass getArray() {
return arrayClass;
}
|
public BeanManager getBeanManager() {
return beanManager;
}
|
public RubyClass getBignum() {
return bignumClass;
}
|
public RubyClass getBinding() {
return bindingClass;
}
|
public CacheMap getCacheMap() {
return cacheMap;
}
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() {
if (charsetMap == null) charsetMap = new RubyHash(this);
return charsetMap;
}
|
public RubyClass getClass(String name) {
return objectClass.getClass(name);
}
Retrieve the class with the given name from the Object namespace. |
public RubyClass getClassClass() {
return classClass;
}
|
public RubyModule getClassFromPath(String path) {
RubyModule c = getObject();
if (path.length() == 0 || path.charAt(0) == '#") {
throw newTypeError("can't retrieve anonymous class " + path);
}
int pbeg = 0, p = 0;
for(int l=path.length(); p< l; ) {
while(p< l && path.charAt(p) != ':") {
p++;
}
String str = path.substring(pbeg, p);
if(p< l && path.charAt(p) == ':") {
if(p+1 < l && path.charAt(p+1) != ':") {
throw newTypeError("undefined class/module " + path.substring(pbeg,p));
}
p += 2;
pbeg = p;
}
IRubyObject cc = c.getConstant(str);
if(!(cc instanceof RubyModule)) {
throw newTypeError("" + path + " does not refer to class/module");
}
c = (RubyModule)cc;
}
return c;
}
|
public static ClassLoader getClassLoader() {
// we try to get the classloader that loaded JRuby, falling back on System
ClassLoader loader = Ruby.class.getClassLoader();
if (loader == null) {
loader = ClassLoader.getSystemClassLoader();
}
return loader;
}
|
public RubyModule getComparable() {
return comparableModule;
}
|
public RubyClass getContinuation() {
return continuationClass;
}
|
public ThreadContext getCurrentContext() {
return threadService.getCurrentContext();
}
|
public String getCurrentDirectory() {
return currentDirectory;
}
|
public static Ruby getCurrentInstance() {
return null;
}
|
public IRubyObject getDebug() {
return debug;
}
Getter for property isDebug. |
public static Ruby getDefaultInstance() {
return newInstance();
} Deprecated! use - #newInstance()
|
public RubyThreadGroup getDefaultThreadGroup() {
return defaultThreadGroup;
}
|
public Map getDescriptors() {
return descriptors;
}
|
public RubyClass getDir() {
return dirClass;
}
|
public RubyClass getDummy() {
return dummyClass;
}
|
public RubyClass getEOFError() {
return eofError;
}
|
public RubyModule getEnumerable() {
return enumerableModule;
}
|
public PrintStream getErr() {
return err;
}
|
public RubyModule getErrno() {
return errnoModule;
}
|
public RubyClass getErrno(int n) {
return errnos.get(n);
}
|
public PrintStream getErrorStream() {
// FIXME: We can't guarantee this will always be a RubyIO...so the old code here is not safe
/*java.io.OutputStream os = ((RubyIO) getGlobalVariables().get("$stderr")).getOutStream();
if(null != os) {
return new PrintStream(os);
} else {
return new PrintStream(new org.jruby.util.SwallowingOutputStream());
}*/
return new PrintStream(new IOOutputStream(getGlobalVariables().get("$stderr")));
}
|
public RubyModule getEtc() {
return etcModule;
}
|
public RubyClass getException() {
return exceptionClass;
}
|
public ExecutorService getExecutor() {
return executor;
}
|
public RubyBoolean getFalse() {
return falseObject;
}
Returns the "false" instance from the instance pool. |
public RubyClass getFalseClass() {
return falseClass;
}
|
public RubyClass getFatal() {
return fatal;
}
|
public RubyClass getFile() {
return fileClass;
}
|
public RubyClass getFileStat() {
return fileStatClass;
}
|
public RubyModule getFileTest() {
return fileTestModule;
}
|
public RubyClass getFixnum() {
return fixnumClass;
}
|
public RubyClass getFloat() {
return floatClass;
}
|
public RubyClass getFloatDomainError() {
return floatDomainError;
}
|
public RubyModule getGC() {
return gcModule;
}
|
public long getGlobalState() {
synchronized(this) {
return globalState;
}
}
|
public GlobalVariables getGlobalVariables() {
return globalVariables;
}
|
public IRubyObject getGroupStruct() {
return groupStruct;
}
|
public RubyClass getHash() {
return hashClass;
}
|
public RubyClass getIO() {
return ioClass;
}
|
public RubyClass getIOError() {
return ioError;
}
|
public InputStream getIn() {
return in;
}
|
public RubyClass getIndexError() {
return indexError;
}
|
public InputStream getInputStream() {
return new IOInputStream(getGlobalVariables().get("$stdin"));
}
|
public RubyInstanceConfig getInstanceConfig() {
return config;
}
|
public RubyClass getInteger() {
return integerClass;
}
|
public RubyClass getInterrupt() {
return interrupt;
}
|
public JITCompiler getJITCompiler() {
return jitCompiler;
}
|
public synchronized JRubyClassLoader getJRubyClassLoader() {
// FIXME: Get rid of laziness and handle restricted access elsewhere
if (!Ruby.isSecurityRestricted() && jrubyClassLoader == null) {
jrubyClassLoader = new JRubyClassLoader(config.getLoader());
}
return jrubyClassLoader;
}
|
public String getJRubyHome() {
return config.getJRubyHome();
}
|
public JavaSupport getJavaSupport() {
return javaSupport;
}
|
public Set getJittedMethods() {
return jittedMethods;
}
|
public KCode getKCode() {
return kcode;
}
|
public RubyModule getKernel() {
return kernelModule;
}
|
public RubyClass getLoadError() {
return loadError;
}
|
public LoadService getLoadService() {
return loadService;
}
|
public RubyClass getLocalJumpError() {
return localJumpError;
}
|
public RubyModule getMarshal() {
return marshalModule;
}
|
public RubyClass getMatchData() {
return matchDataClass;
}
|
public RubyModule getMath() {
return mathModule;
}
|
public RubyClass getMethod() {
return methodClass;
}
|
public RubyClass getModule() {
return moduleClass;
}
|
public RubyModule getModule(String name) {
return (RubyModule) objectClass.getConstantAt(name);
}
Retrieve the module with the given name from the Object namespace. |
public RubyClass getNameError() {
return nameError;
}
|
public RubyClass getNameErrorMessage() {
return nameErrorMessage;
}
|
public RubyClass getNativeException() {
return nativeException;
}
|
public IRubyObject getNil() {
return nilObject;
}
Returns the "nil" singleton instance. |
public RubyClass getNilClass() {
return nilClass;
}
|
public RubyClass getNoMemoryError() {
return noMemoryError;
}
|
public RubyClass getNoMethodError() {
return noMethodError;
}
|
public RubyClass getNotImplementedError() {
return notImplementedError;
}
|
public RubyClass getNumeric() {
return numericClass;
}
|
public RubyClass getObject() {
return objectClass;
}
|
public ObjectSpace getObjectSpace() {
return objectSpace;
}
|
public RubyModule getObjectSpaceModule() {
return objectSpaceModule;
}
|
public Object getObjectToYamlMethod() {
return objectToYamlMethod;
}
|
public RubyModule getOrCreateModule(String name) {
IRubyObject module = objectClass.getConstantAt(name);
if (module == null) {
module = defineModule(name);
} else if (getSafeLevel() >= 4) {
throw newSecurityError("Extending module prohibited.");
} else if (!module.isModule()) {
throw newTypeError(name + " is not a Module");
}
return (RubyModule) module;
}
From Object, retrieve the named module. If it doesn't exist a
new module is created. |
public PrintStream getOut() {
return out;
}
|
public PrintStream getOutputStream() {
return new PrintStream(new IOOutputStream(getGlobalVariables().get("$stdout")));
}
|
public IRubyObject getPasswdStruct() {
return passwdStruct;
}
|
public POSIX getPosix() {
return posix;
}
|
public RubyModule getPrecision() {
return precisionModule;
}
|
public RubyClass getProc() {
return procClass;
}
|
public RubyModule getProcGID() {
return procGIDModule;
}
|
public RubyClass getProcStatus() {
return procStatusClass;
}
|
public RubyModule getProcSysModule() {
return procSysModule;
}
|
public RubyModule getProcUID() {
return procUIDModule;
}
|
public RubyModule getProcess() {
return processModule;
}
|
public Profile getProfile() {
return profile;
}
|
public Random getRandom() {
return random;
}
|
public long getRandomSeed() {
return randomSeed;
}
|
public RubyClass getRange() {
return rangeClass;
}
|
public RubyClass getRangeError() {
return rangeError;
}
|
public GlobalVariable getRecordSeparatorVar() {
return recordSeparatorVar;
}
|
public RubyClass getRegexp() {
return regexpClass;
}
|
public RubyClass getRegexpError() {
return regexpError;
}
|
Object getRespondToMethod() {
return respondToMethod;
}
|
public RubyClass getRuntimeError() {
return runtimeError;
}
|
public int getSafeLevel() {
return this.safeLevel;
}
Retrieve the current safe level. |
public RubyClass getSecurityError() {
return securityError;
}
|
public RubyClass getSignalException() {
return signalException;
}
|
public int getStackTraces() {
return stackTraces;
}
|
public RubyClass getStandardError() {
return standardError;
}
|
public long getStartTime() {
return startTime;
}
|
public RubyClass getString() {
return stringClass;
}
|
public RubyClass getStructClass() {
return structClass;
}
|
public RubyClass getSymbol() {
return symbolClass;
}
|
public RubySymbol.SymbolTable getSymbolTable() {
return symbolTable;
}
|
public RubyClass getSyntaxError() {
return syntaxError;
}
|
public RubyClass getSystemCallError() {
return systemCallError;
}
|
public RubyClass getSystemExit() {
return systemExit;
}
|
public RubyClass getSystemStackError() {
return systemStackError;
}
|
public RubyClass getThread() {
return threadClass;
}
|
public RubyClass getThreadError() {
return threadError;
}
|
public RubyClass getThreadGroup() {
return threadGroupClass;
}
|
public ThreadService getThreadService() {
return threadService;
}
|
public RubyClass getTime() {
return timeClass;
}
|
public IRubyObject getTmsStruct() {
return tmsStruct;
}
|
public IRubyObject getTopSelf() {
return topSelf;
}
Getter for property rubyTopSelf. |
public RubyBoolean getTrue() {
return trueObject;
}
Returns the "true" instance from the instance pool. |
public RubyClass getTrueClass() {
return trueClass;
}
|
public RubyClass getTypeError() {
return typeError;
}
|
public RubyClass getUnboundMethod() {
return unboundMethodClass;
}
|
public IRubyObject getVerbose() {
return verbose;
}
Getter for property isVerbose. |
public RubyWarnings getWarnings() {
return warnings;
}
|
public RubyClass getZeroDivisionError() {
return zeroDivisionError;
}
|
public boolean hasEventHooks() {
return hasEventHooks;
}
|
public void incGlobalState() {
synchronized(this) {
globalState = (globalState+1) & 0x8fffffff;
}
}
|
public long incrementRandomSeedSequence() {
return randomSeedSequence++;
}
|
public boolean isClassDefined(String name) {
return getModule(name) != null;
}
|
public boolean isDoNotReverseLookupEnabled() {
return doNotReverseLookupEnabled;
}
|
public boolean isGlobalAbortOnExceptionEnabled() {
return globalAbortOnExceptionEnabled;
}
|
public boolean isInspecting(Object obj) {
Map< Object, Object > val = inspect.get();
return val == null ? false : val.containsKey(obj);
}
|
public boolean isObjectSpaceEnabled() {
return objectSpaceEnabled;
}
|
public static boolean isSecurityRestricted() {
return securityRestricted;
}
|
public void loadFile(String scriptName,
InputStream in,
boolean wrap) {
IRubyObject self = wrap ? TopSelfFactory.createTopSelf(this) : getTopSelf();
ThreadContext context = getCurrentContext();
String file = context.getFile();
try {
secure(4); /* should alter global state */
context.setFile(scriptName);
context.preNodeEval(objectClass, self, scriptName);
parseFile(in, scriptName, null).interpret(this, context, self, Block.NULL_BLOCK);
} catch (JumpException.ReturnJump rj) {
return;
} finally {
context.postNodeEval();
context.setFile(file);
}
}
|
public void loadScript(Script script) {
IRubyObject self = getTopSelf();
ThreadContext context = getCurrentContext();
try {
secure(4); /* should alter global state */
context.preNodeEval(objectClass, self);
script.load(context, self, IRubyObject.NULL_ARRAY, Block.NULL_BLOCK);
} catch (JumpException.ReturnJump rj) {
return;
} finally {
context.postNodeEval();
}
}
|
public RaiseException newArgumentError(String message) {
return newRaiseException(getArgumentError(), message);
}
|
public RaiseException newArgumentError(int got,
int expected) {
return newRaiseException(getArgumentError(), "wrong # of arguments(" + got + " for " + expected + ")");
}
|
public RubyArray newArray() {
return RubyArray.newArray(this);
}
|
public RubyArray newArray(IRubyObject object) {
return RubyArray.newArray(this, object);
}
|
public RubyArray newArray(IRubyObject[] objects) {
return RubyArray.newArray(this, objects);
}
|
public RubyArray newArray(List list) {
return RubyArray.newArray(this, list);
}
|
public RubyArray newArray(int size) {
return RubyArray.newArray(this, size);
}
|
public RubyArray newArray(IRubyObject car,
IRubyObject cdr) {
return RubyArray.newArray(this, car, cdr);
}
|
public RubyArray newArrayLight() {
return RubyArray.newArrayLight(this);
}
|
public RubyArray newArrayNoCopy(IRubyObject[] objects) {
return RubyArray.newArrayNoCopy(this, objects);
}
|
public RubyArray newArrayNoCopyLight(IRubyObject[] objects) {
return RubyArray.newArrayNoCopyLight(this, objects);
}
|
public RubyBinding newBinding() {
return RubyBinding.newBinding(this);
}
|
public RubyBinding newBinding(Binding binding) {
return RubyBinding.newBinding(this, binding);
}
|
public RubyProc newBlockPassProc(Block.Type type,
Block block) {
if (type != Block.Type.LAMBDA && block.getProcObject() != null) return block.getProcObject();
RubyProc proc = RubyProc.newProc(this, type);
proc.initialize(getCurrentContext(), block);
return proc;
}
|
public RubyBoolean newBoolean(boolean value) {
return RubyBoolean.newBoolean(this, value);
}
|
public RaiseException newEOFError() {
return newRaiseException(getEOFError(), "End of file reached");
}
|
public RaiseException newEOFError(String message) {
return newRaiseException(getEOFError(), message);
}
|
public RubyArray newEmptyArray() {
return RubyArray.newEmptyArray(this);
}
|
public RaiseException newErrnoEACCESError(String message) {
return newRaiseException(getErrno().fastGetClass("EACCES"), message);
}
|
public RaiseException newErrnoEADDRINUSEError() {
return newRaiseException(getErrno().fastGetClass("EADDRINUSE"), "Address in use");
}
|
public RaiseException newErrnoEAGAINError(String message) {
return newRaiseException(getErrno().fastGetClass("EAGAIN"), message);
}
|
public RaiseException newErrnoEBADFError() {
return newRaiseException(getErrno().fastGetClass("EBADF"), "Bad file descriptor");
}
|
public RaiseException newErrnoEBADFError(String message) {
return newRaiseException(getErrno().fastGetClass("EBADF"), message);
}
|
public RaiseException newErrnoECHILDError() {
return newRaiseException(getErrno().fastGetClass("ECHILD"), "No child processes");
}
|
public RaiseException newErrnoECONNREFUSEDError() {
return newRaiseException(getErrno().fastGetClass("ECONNREFUSED"), "Connection refused");
}
|
public RaiseException newErrnoECONNRESETError() {
return newRaiseException(getErrno().fastGetClass("ECONNRESET"), "Connection reset by peer");
}
|
public RaiseException newErrnoEDOMError(String message) {
return newRaiseException(getErrno().fastGetClass("EDOM"), "Domain error - " + message);
}
|
public RaiseException newErrnoEEXISTError(String message) {
return newRaiseException(getErrno().fastGetClass("EEXIST"), message);
}
|
public RaiseException newErrnoEINVALError() {
return newRaiseException(getErrno().fastGetClass("EINVAL"), "Invalid file");
}
|
public RaiseException newErrnoEINVALError(String message) {
return newRaiseException(getErrno().fastGetClass("EINVAL"), message);
}
|
public RaiseException newErrnoEISDirError() {
return newRaiseException(getErrno().fastGetClass("EISDIR"), "Is a directory");
}
|
public RaiseException newErrnoENOENTError() {
return newRaiseException(getErrno().fastGetClass("ENOENT"), "File not found");
}
|
public RaiseException newErrnoENOENTError(String message) {
return newRaiseException(getErrno().fastGetClass("ENOENT"), message);
}
|
public RaiseException newErrnoENOPROTOOPTError() {
return newRaiseException(getErrno().fastGetClass("ENOPROTOOPT"), "Protocol not available");
}
|
public RaiseException newErrnoENOTDIRError(String message) {
return newRaiseException(getErrno().fastGetClass("ENOTDIR"), message);
}
|
public RaiseException newErrnoENOTSOCKError(String message) {
return newRaiseException(getErrno().fastGetClass("ENOTSOCK"), message);
}
|
public RaiseException newErrnoEPIPEError() {
return newRaiseException(getErrno().fastGetClass("EPIPE"), "Broken pipe");
}
|
public RaiseException newErrnoESPIPEError() {
return newRaiseException(getErrno().fastGetClass("ESPIPE"), "Illegal seek");
}
|
public RaiseException newErrnoESPIPEError(String message) {
return newRaiseException(getErrno().fastGetClass("ESPIPE"), message);
}
|
public RubyFileStat newFileStat(FileDescriptor descriptor) {
return RubyFileStat.newFileStat(this, descriptor);
}
|
public RubyFileStat newFileStat(String filename,
boolean lstat) {
return RubyFileStat.newFileStat(this, filename, lstat);
}
|
public RubyFixnum newFixnum(long value) {
return RubyFixnum.newFixnum(this, value);
}
|
public RubyFixnum newFixnum(int value) {
return RubyFixnum.newFixnum(this, value);
}
|
public RubyFloat newFloat(double value) {
return RubyFloat.newFloat(this, value);
}
|
public RaiseException newFloatDomainError(String message) {
return newRaiseException(getFloatDomainError(), message);
}
|
public RaiseException newFrozenError(String objectType) {
// TODO: Should frozen error have its own distinct class? If not should more share?
return newRaiseException(getTypeError(), "can't modify frozen " + objectType);
}
|
public RaiseException newIOError(String message) {
return newRaiseException(getIOError(), message);
}
|
public RaiseException newIOErrorFromException(IOException ioe) {
// TODO: this is kinda gross
if(ioe.getMessage() != null) {
if (ioe.getMessage().equals("Broken pipe")) {
throw newErrnoEPIPEError();
} else if (ioe.getMessage().equals("Connection reset by peer")) {
throw newErrnoECONNRESETError();
}
return newRaiseException(getIOError(), ioe.getMessage());
} else {
return newRaiseException(getIOError(), "IO Error");
}
}
|
public RaiseException newIndexError(String message) {
return newRaiseException(getIndexError(), message);
}
|
public static Ruby newInstance() {
return newInstance(new RubyInstanceConfig());
}
Returns a new instance of the JRuby runtime configured with defaults. |
public static Ruby newInstance(RubyInstanceConfig config) {
Ruby ruby = new Ruby(config);
ruby.init();
return ruby;
}
Returns a new instance of the JRuby runtime configured as specified. |
public static Ruby newInstance(InputStream in,
PrintStream out,
PrintStream err) {
RubyInstanceConfig config = new RubyInstanceConfig();
config.setInput(in);
config.setOutput(out);
config.setError(err);
return newInstance(config);
}
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) {
return newRaiseException(fastGetClass("Iconv").fastGetClass("InvalidEncoding"), message);
}
|
public RaiseException newLoadError(String message) {
return newRaiseException(getLoadError(), message);
}
|
public RaiseException newLocalJumpError(String reason,
IRubyObject exitValue,
|