Refine search
public String toString() { switch (type) { case KILL: return description; case RAISE: return description + ": " + exception.getMetaClass().getRealClass(); case WAKEUP: return description; } return ""; // not reached }
public String toString() { switch (type) { case KILL: return description; case RAISE: return description + ": " + exception.getMetaClass().getRealClass(); case WAKEUP: return description; } return ""; // not reached }
protected static void objInitCopy(IRubyObject obj, IRubyObject orig) { if (obj == orig) return; // FIXME: booooo! ((RubyBasicObject)obj).checkFrozen(); // Not implemented // checkTrusted(); if (obj.getClass() != orig.getClass() || obj.getMetaClass().getRealClass() != orig.getMetaClass().getRealClass()) { throw obj.getRuntime().newTypeError("initialize_copy should take same class object"); } }
protected static void objInitCopy(IRubyObject obj, IRubyObject orig) { if (obj == orig) return; // FIXME: booooo! ((RubyBasicObject)obj).checkFrozen(); // Not implemented // checkTrusted(); if (obj.getClass() != orig.getClass() || obj.getMetaClass().getRealClass() != orig.getMetaClass().getRealClass()) { throw obj.getRuntime().newTypeError("initialize_copy should take same class object"); } }
private static String formatReceiver(final IRubyObject object) { if ( object instanceof RubyModule ) { return ((RubyModule) object).getName(); } return object.getMetaClass().getRealClass().getName(); }
/** * @param object * @return {@code true} if the given Ruby object is recognized as this node type. */ public boolean isInstance(IRubyObject object) { Ruby rubyRuntime = object.getRuntime(); return getRubyClass(rubyRuntime).equals(object.getMetaClass().getRealClass()); } }
static RubyModule getModuleForAutoload(Ruby runtime, IRubyObject recv) { RubyModule module = recv instanceof RubyModule ? (RubyModule) recv : recv.getMetaClass().getRealClass(); if (module == runtime.getKernel()) { // special behavior if calling Kernel.autoload directly module = runtime.getObject().getSingletonClass(); } return module; }
/** * @param object * @return {@code true} if the given Ruby object is recognized as this node type. */ public boolean isInstance(IRubyObject object) { Ruby rubyRuntime = object.getRuntime(); return getRubyClass(rubyRuntime).equals(object.getMetaClass().getRealClass()); } }
private static boolean other2bool(IRubyObject parameter) { if (parameter instanceof RubyNumeric) { return ((RubyNumeric) parameter).getLongValue() != 0; } throw parameter.getRuntime().newTypeError("cannot convert " + parameter.getMetaClass().getRealClass() + " to bool"); }
static RubyModule getModuleForAutoload(Ruby runtime, IRubyObject recv) { RubyModule module = recv instanceof RubyModule ? (RubyModule) recv : recv.getMetaClass().getRealClass(); if (module == runtime.getKernel()) { // special behavior if calling Kernel.autoload directly module = runtime.getObject().getSingletonClass(); } return module; }
private static String typeAsString(IRubyObject obj) { if (obj.isNil()) return "nil"; if (obj instanceof RubyBoolean) return obj.isTrue() ? "true" : "false"; return obj.getMetaClass().getRealClass().getName(); }
public VariableAccessor getAccessor(IRubyObject o) { RubyClass cls = o.getMetaClass().getRealClass(); VariableAccessor localAccessor = accessor; if (localAccessor.getClassId() != cls.hashCode()) { localAccessor = cls.getVariableAccessorForRead(getId()); accessor = localAccessor; } return localAccessor; }
@Override @JRubyMethod(name = "==") public RubyBoolean op_equal(ThreadContext context, IRubyObject other) { if (this == other) return context.tru; boolean equal = context.runtime.getException().isInstance(other) && getMetaClass().getRealClass() == other.getMetaClass().getRealClass() && callMethod(context, "message").equals(other.callMethod(context, "message")) && callMethod(context, "backtrace").equals(other.callMethod(context, "backtrace")); return context.runtime.newBoolean(equal); }
public VariableAccessor getAccessor(IRubyObject o) { RubyClass cls = o.getMetaClass().getRealClass(); VariableAccessor localAccessor = accessor; if (localAccessor.getClassId() != cls.hashCode()) { localAccessor = cls.getVariableAccessorForWrite(getId()); accessor = localAccessor; } return localAccessor; }
public final Pointer getCallback(IRubyObject callable, CachingCallSite callSite) { if (callable instanceof Pointer) { return (Pointer) callable; } Object ffiHandle = callable.getMetaClass().getRealClass().getFFIHandleAccessorField().getVariableAccessorForRead().get(callable); NativeCallbackPointer cbptr; if (ffiHandle instanceof NativeCallbackPointer && ((cbptr = (NativeCallbackPointer) ffiHandle).cbInfo == callbackInfo)) { return cbptr; } return getCallbackPointer(callable, callSite); }
private final IRubyObject getValue(ThreadContext context, int index, String name, IRubyObject object) { VariableAccessor variableAccessor = variableReaders[index]; RubyClass cls = object.getMetaClass().getRealClass(); if (variableAccessor.getClassId() != cls.hashCode()) { variableReaders[index] = variableAccessor = cls.getVariableAccessorForRead(name); } return (IRubyObject)variableAccessor.get(object); }
public void ivarSetFail(IRubyObject self, IRubyObject value) { VariableAccessor variableAccessor = accessor; RubyClass cls = self.getMetaClass().getRealClass(); if (variableAccessor.getClassId() != cls.hashCode()) { accessor = variableAccessor = cls.getVariableAccessorForWrite(name); } variableAccessor.set(self, value); }
public final IRubyObject setVariable(int index, String name, IRubyObject object, IRubyObject value) { VariableAccessor variableAccessor = variableWriters[index]; RubyClass cls = object.getMetaClass().getRealClass(); if (variableAccessor.getClassId() != cls.hashCode()) { variableWriters[index] = variableAccessor = cls.getVariableAccessorForWrite(name); } variableAccessor.set(object, value); return value; }
public final IRubyObject setVariable(IRubyObject object, IRubyObject value) { VariableAccessor variableAccessor = accessor; RubyClass cls = object.getMetaClass().getRealClass(); if (variableAccessor.getClassId() != cls.hashCode()) { accessor = variableAccessor = cls.getVariableAccessorForWrite(name); } variableAccessor.set(object, value); return value; }
@Override public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) { RubyClass cls = self.getMetaClass().getRealClass(); IRubyObject value = getValueNode().interpret(runtime, context, self, aBlock); verifyAccessor(cls).set(self, value); return value; }