case MESSAGE: RubyClass typeClass = (RubyClass) ((RubyDescriptor) getDescriptorForField(context, fieldDescriptor)).msgclass(context); if (!value.getMetaClass().equals(typeClass)) throw runtime.newTypeError(value, "Invalid type to assign to submessage field."); val = ((RubyMessage) value).build(context, depth + 1);
private String formatMessage(final IRubyObject msg) { if (getRuntime().getString().equals(msg.getType())) { return msg.asJavaString(); } else if (getRuntime().getHash().equals(msg.getType())) { final RubyHash hash = (RubyHash) msg; return Objects.toString(hash.get(getRuntime().newSymbol(LOG_PROPERTY_TEXT))); } throw new IllegalArgumentException(Objects.toString(msg)); }
private String formatMessage(final IRubyObject msg) { if (getRuntime().getString().equals(msg.getType())) { return msg.asJavaString(); } else if (getRuntime().getHash().equals(msg.getType())) { final RubyHash hash = (RubyHash) msg; return Objects.toString(hash.get(getRuntime().newSymbol(LOG_PROPERTY_TEXT))); } throw new IllegalArgumentException(Objects.toString(msg)); }
/** * @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()); } }
/** * @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()); } }
@Override @JRubyMethod(name = "==", required = 1) public IRubyObject op_equal(ThreadContext context, IRubyObject obj) { if (!getType().equals(obj.getType())) { return context.fals; } return context.runtime.newBoolean(random.equals(((RubyRandom) obj).random)); }
@Override @JRubyMethod(name = "==", required = 1) public IRubyObject op_equal(ThreadContext context, IRubyObject obj) { if (!getType().equals(obj.getType())) { return context.fals; } return context.runtime.newBoolean(random.equals(((RubyRandom) obj).random)); }
@Override @JRubyMethod(name = "==", required = 1, compat = RUBY1_9) public IRubyObject op_equal_19(ThreadContext context, IRubyObject obj) { if (!getType().equals(obj.getType())) { return context.runtime.getFalse(); } return context.runtime.newBoolean(random.equals(((RubyRandom) obj).random)); }
@Override @JRubyMethod(name = "==", required = 1, compat = RUBY1_9) public IRubyObject op_equal_19(ThreadContext context, IRubyObject obj) { if (!getType().equals(obj.getType())) { return context.runtime.getFalse(); } return context.runtime.newBoolean(random.equals(((RubyRandom) obj).random)); }
private Cursor getSourceLocation(IRubyObject msg) { if (getRuntime().getHash().equals(msg.getType())) { final RubyHash hash = (RubyHash) msg; final Object sourceLocation = hash.get(getRuntime().newSymbol(LOG_PROPERTY_SOURCE_LOCATION)); return new CursorImpl((IRubyObject) sourceLocation); } return null; } }
private Cursor getSourceLocation(IRubyObject msg) { if (getRuntime().getHash().equals(msg.getType())) { final RubyHash hash = (RubyHash) msg; final Object sourceLocation = hash.get(getRuntime().newSymbol(LOG_PROPERTY_SOURCE_LOCATION)); return new CursorImpl((IRubyObject) sourceLocation); } return null; } }
IRubyObject err = runtime.getNil(); boolean isErrnoClass = !klass.equals(sCallErorrClass);
IRubyObject err = runtime.getNil(); boolean isErrnoClass = !klass.equals(sCallErorrClass);
IRubyObject err = runtime.getNil(); boolean isErrnoClass = !klass.equals(sCallErorrClass);
IRubyObject err = runtime.getNil(); boolean isErrnoClass = !klass.equals(sCallErorrClass);