本文整理了Java中org.jruby.RubyClass.getRealClass
方法的一些代码示例,展示了RubyClass.getRealClass
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RubyClass.getRealClass
方法的具体详情如下:
包路径:org.jruby.RubyClass
类名称:RubyClass
方法名:getRealClass
暂无
代码示例来源:origin: org.jruby/jruby-complete
public String toString() {
switch (type) {
case KILL: return description;
case RAISE: return description + ": " + exception.getMetaClass().getRealClass();
case WAKEUP: return description;
}
return ""; // not reached
}
代码示例来源:origin: org.jruby/jruby-core
public String toString() {
switch (type) {
case KILL: return description;
case RAISE: return description + ": " + exception.getMetaClass().getRealClass();
case WAKEUP: return description;
}
return ""; // not reached
}
代码示例来源:origin: org.jruby/jruby-complete
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");
}
}
代码示例来源:origin: org.jruby/jruby-core
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");
}
}
代码示例来源:origin: org.jruby/jruby-complete
private static String formatReceiver(final IRubyObject object) {
if ( object instanceof RubyModule ) {
return ((RubyModule) object).getName();
}
return object.getMetaClass().getRealClass().getName();
}
代码示例来源:origin: asciidoctor/asciidoctorj
/**
* @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());
}
}
代码示例来源:origin: org.jruby/jruby-complete
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;
}
代码示例来源:origin: org.asciidoctor/asciidoctorj
/**
* @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());
}
}
代码示例来源:origin: org.jruby/jruby-complete
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");
}
代码示例来源:origin: org.jruby/jruby-core
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;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
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();
}
代码示例来源:origin: org.jruby/jruby-complete
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;
}
代码示例来源:origin: org.jruby/jruby-complete
@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);
}
代码示例来源:origin: org.jruby/jruby-complete
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;
}
代码示例来源:origin: org.jruby/jruby-complete
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);
}
代码示例来源:origin: org.jruby/jruby-complete
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);
}
代码示例来源:origin: org.jruby/jruby-complete
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);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
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;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
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;
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
@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;
}
内容来源于网络,如有侵权,请联系作者删除!