@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 = "hexdigest!") public static IRubyObject hexdigest_bang(ThreadContext ctx, IRubyObject self) { return toHexString(ctx.runtime, digest_bang(ctx, self).convertToString().getBytes()); }
@JRubyMethod() public static IRubyObject inspect(ThreadContext ctx, IRubyObject self) { return RubyString.newStringNoCopy(self.getRuntime(), ByteList.plain("#<" + self.getMetaClass().getRealClass().getName() + ": " + hexdigest(ctx, self, null) + ">")); }
@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() public static IRubyObject reset(ThreadContext ctx, IRubyObject self) { return throwUnimplError(self, "reset"); }
@JRubyMethod() public static IRubyObject block_length(ThreadContext context, IRubyObject self) { return throwUnimplError(self, "block_length"); }
@JRubyMethod() public static IRubyObject digest_length(ThreadContext context, IRubyObject self) { return digest(context, self, null).convertToString().bytesize(); }
@JRubyMethod() public static IRubyObject block_length(ThreadContext ctx, IRubyObject self) { return throwUnimplError(self, "block_length"); }
@JRubyMethod() public static IRubyObject reset(ThreadContext ctx, IRubyObject self) { return throwUnimplError(self, "reset"); }
@JRubyMethod(optional = 1) public static IRubyObject hexdigest(ThreadContext ctx, IRubyObject self, IRubyObject[] args) { return toHexString(ctx.runtime, digest(ctx, self, args).convertToString().getBytes()); }
@JRubyMethod(optional = 1) public static IRubyObject hexdigest(ThreadContext ctx, IRubyObject self, IRubyObject[] args) { return toHexString(ctx.runtime, digest(ctx, self, args).convertToString().getBytes()); }
@JRubyMethod() public static IRubyObject reset(ThreadContext context, IRubyObject self) { return throwUnimplError(self, "reset"); }
@JRubyMethod() public static IRubyObject finish(ThreadContext context, IRubyObject self) { return throwUnimplError(self, "finish"); }
@JRubyMethod() public static IRubyObject inspect(ThreadContext context, IRubyObject self) { return RubyString.newStringNoCopy(self.getRuntime(), ByteList.plain("#<" + self.getMetaClass().getRealClass().getName() + ": " + hexdigest(context, self, null) + ">")); }
@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(optional = 1) public static IRubyObject hexdigest(ThreadContext context, IRubyObject self, IRubyObject[] args) { return toHexString(context.runtime, digest(context, self, args).convertToString().getBytes()); }
@JRubyMethod(name = {"update", "<<"}, required = 1) public static IRubyObject update(ThreadContext context, IRubyObject self, IRubyObject arg) { return throwUnimplError(self, "update"); }
@JRubyMethod(name = "hexdigest!") public static IRubyObject hexdigest_bang(ThreadContext context, IRubyObject self) { return toHexString(context.runtime, digest_bang(context, self).convertToString().getBytes()); }
@JRubyMethod() public static IRubyObject digest_length(ThreadContext ctx, IRubyObject self) { return digest(ctx, self, null).convertToString().length(); }