public boolean isKindOf(IRubyObject obj, RubyModule type) { return obj.getMetaClass().hasModuleInHierarchy(type); } }
public boolean isKindOf(IRubyObject obj, RubyModule type) { return obj.getMetaClass().hasModuleInHierarchy(type); } }
public boolean isKindOf(IRubyObject obj, RubyModule type) { return obj.getMetaClass().hasModuleInHierarchy(type); } }
public boolean isKindOf(IRubyObject obj, RubyModule type) { return obj.getMetaClass().hasModuleInHierarchy(type); } }
/** * Replaces the contents of the set with the contents of the given enumerable object and returns self. */ @JRubyMethod public RubySet replace(final ThreadContext context, IRubyObject enume) { if ( enume instanceof RubySet ) { modifyCheck(context.runtime); clearImpl(); addImplSet(context, (RubySet) enume); } else { final Ruby runtime = context.runtime; // do_with_enum(enum) # make sure enum is enumerable before calling clear : if ( ! enume.getMetaClass().hasModuleInHierarchy(runtime.getEnumerable()) ) { // NOTE: likely no need to do this but due MRI compat (do_with_enum) : if ( ! enume.respondsTo("each_entry") ) { throw runtime.newArgumentError("value must be enumerable"); } } clearImpl(); rb_merge(context, enume); } return this; }
/** * Replaces the contents of the set with the contents of the given enumerable object and returns self. */ @JRubyMethod public RubySet replace(final ThreadContext context, IRubyObject enume) { if ( enume instanceof RubySet ) { modifyCheck(context.runtime); clearImpl(); addImplSet(context, (RubySet) enume); } else { final Ruby runtime = context.runtime; // do_with_enum(enum) # make sure enum is enumerable before calling clear : if ( ! enume.getMetaClass().hasModuleInHierarchy(runtime.getEnumerable()) ) { // NOTE: likely no need to do this but due MRI compat (do_with_enum) : if ( ! enume.respondsTo("each_entry") ) { throw runtime.newArgumentError("value must be enumerable"); } } clearImpl(); rb_merge(context, enume); } return this; }
@JRubyMethod(name = "==", required = 1) public static IRubyObject op_equal(ThreadContext context, IRubyObject self, IRubyObject oth) { if(oth.isNil()) return context.fals; RubyString str1, str2; RubyModule instance = (RubyModule)context.runtime.getModule("Digest").getConstantAt("Instance"); if (oth.getMetaClass().getRealClass().hasModuleInHierarchy(instance)) { str1 = digest(context, self, null).convertToString(); str2 = digest(context, oth, null).convertToString(); } else { str1 = to_s(context, self).convertToString(); str2 = oth.convertToString(); } boolean ret = str1.bytesize().eql(str2.bytesize()) && (str1.eql(str2)); return ret ? context.tru : context.fals; }
@JRubyMethod(name = "==", required = 1) public static IRubyObject op_equal(ThreadContext context, IRubyObject self, IRubyObject oth) { if(oth.isNil()) return context.fals; RubyString str1, str2; RubyModule instance = (RubyModule)context.runtime.getModule("Digest").getConstantAt("Instance"); if (oth.getMetaClass().getRealClass().hasModuleInHierarchy(instance)) { str1 = digest(context, self, null).convertToString(); str2 = digest(context, oth, null).convertToString(); } else { str1 = to_s(context, self).convertToString(); str2 = oth.convertToString(); } boolean ret = str1.bytesize().eql(str2.bytesize()) && (str1.eql(str2)); return ret ? context.tru : context.fals; }
@JRubyMethod(name = "==", required = 1) public static IRubyObject op_equal(ThreadContext ctx, IRubyObject self, IRubyObject oth) { RubyString str1, str2; RubyModule instance = (RubyModule)self.getRuntime().getModule("Digest").getConstantAt("Instance"); if (oth.getMetaClass().getRealClass().hasModuleInHierarchy(instance)) { str1 = digest(ctx, self, null).convertToString(); str2 = digest(ctx, oth, null).convertToString(); } else { str1 = to_s(ctx, self).convertToString(); str2 = oth.convertToString(); } boolean ret = str1.length().eql(str2.length()) && (str1.eql(str2)); return ret ? self.getRuntime().getTrue() : self.getRuntime().getFalse(); }
@JRubyMethod(name = "==", required = 1) public static IRubyObject op_equal(ThreadContext ctx, IRubyObject self, IRubyObject oth) { RubyString str1, str2; RubyModule instance = (RubyModule)self.getRuntime().getModule("Digest").getConstantAt("Instance"); if (oth.getMetaClass().getRealClass().hasModuleInHierarchy(instance)) { str1 = digest(ctx, self, null).convertToString(); str2 = digest(ctx, oth, null).convertToString(); } else { str1 = to_s(ctx, self).convertToString(); str2 = oth.convertToString(); } boolean ret = str1.length().eql(str2.length()) && (str1.eql(str2)); return ret ? self.getRuntime().getTrue() : self.getRuntime().getFalse(); }