Skip to content

Commit

Permalink
Showing 2 changed files with 7 additions and 4 deletions.
10 changes: 7 additions & 3 deletions core/src/main/java/org/jruby/RubyClass.java
Original file line number Diff line number Diff line change
@@ -666,10 +666,14 @@ private static boolean checkFuncallRespondTo(ThreadContext context, RubyClass kl

if (arityValue > 2) throw runtime.newArgumentError("respond_to? must accept 1 or 2 arguments (requires " + arityValue + ")");

IRubyObject result = me.call(context, recv, klass, "respond_to?", runtime.newSymbol(mid), runtime.getTrue());
if (!result.isTrue()) {
return false;
IRubyObject result;
if (arityValue == 1) {
result = me.call(context, recv, klass, "respond_to?", runtime.newSymbol(mid));
} else {
result = me.call(context, recv, klass, "respond_to?", runtime.newSymbol(mid), runtime.getTrue());
}

if (!result.isTrue()) return false;
}
return true;
}
1 change: 0 additions & 1 deletion test/mri/excludes/TestObject.rb
Original file line number Diff line number Diff line change
@@ -3,4 +3,3 @@

exclude :test_redefine_method_under_verbose, "needs warning message"
exclude :test_redefine_method_which_may_case_serious_problem, "needs warning message"
exclude :test_implicit_respond_to_arity_1, "needs investigation"

0 comments on commit 029e620

Please sign in to comment.