@JRubyMethod(name = "uniq") public IRubyObject uniq19(ThreadContext context, Block block) { if (!block.isGiven()) return uniq(context); RubyHash hash = makeHash(context, block); RubyArray result = new RubyArray(context.runtime, getMetaClass(), hash.size()); hash.visitAll(context, RubyHash.StoreValueVisitor, result); return result; }
@JRubyMethod(name = "uniq") public IRubyObject uniq19(ThreadContext context, Block block) { if (!block.isGiven()) return uniq(context); RubyHash hash = makeHash(context, block); RubyArray result = new RubyArray(context.runtime, getMetaClass(), hash.size()); hash.visitAll(context, RubyHash.StoreValueVisitor, result); return result; }
@JRubyMethod(name = "uniq", compat = RUBY1_9) public IRubyObject uniq19(ThreadContext context, Block block) { if (!block.isGiven()) return uniq(context); RubyHash hash = makeHash(context, block); final RubyArray result = new RubyArray(context.runtime, getMetaClass(), hash.size()); hash.visitAll(new RubyHash.Visitor() { @Override public void visit(IRubyObject key, IRubyObject value) { result.append(value); } }); return result; }
@JRubyMethod(name = "uniq", compat = RUBY1_9) public IRubyObject uniq19(ThreadContext context, Block block) { if (!block.isGiven()) return uniq(context); RubyHash hash = makeHash(context, block); final RubyArray result = new RubyArray(context.runtime, getMetaClass(), hash.size()); hash.visitAll(new RubyHash.Visitor() { @Override public void visit(IRubyObject key, IRubyObject value) { result.append(value); } }); return result; }