Skip to content

Commit

Permalink
Array#repeated_permutation should have arity 1
Browse files Browse the repository at this point in the history
Remove arg-less Array#repeated_permutation to match MRI behavior.
  • Loading branch information
dmarcotte committed Dec 12, 2013
1 parent f4a6f7e commit 89a7ba2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 0 additions & 5 deletions core/src/main/java/org/jruby/RubyArray.java
Original file line number Diff line number Diff line change
Expand Up @@ -3708,11 +3708,6 @@ public IRubyObject repeated_permutation(ThreadContext context, IRubyObject num,
return block.isGiven() ? permutationCommon(context, RubyNumeric.num2int(num), true, block) : enumeratorize(context.runtime, this, "repeated_permutation", num);
}

@JRubyMethod(name = "repeated_permutation", compat = RUBY1_9)
public IRubyObject repeated_permutation(ThreadContext context, Block block) {
return block.isGiven() ? permutationCommon(context, realLength, true, block) : enumeratorize(context.runtime, this, "repeated_permutation");
}

private IRubyObject permutationCommon(ThreadContext context, int r, boolean repeat, Block block) {
if (r == 0) {
block.yield(context, newEmptyArray(context.runtime));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require 'rspec'

describe "Array#repeated_permutation" do
it "has arity one" do
[].method(:repeated_permutation).arity.should == 1
end
end if RUBY_VERSION >= "1.9"

0 comments on commit 89a7ba2

Please sign in to comment.