Skip to content

Commit

Permalink
Fix MRI Proc.to_s failures
Browse files Browse the repository at this point in the history
  • Loading branch information
enebo committed May 12, 2015
1 parent a2b34ef commit 5720901
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
13 changes: 10 additions & 3 deletions core/src/main/java/org/jruby/RubyProc.java
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,19 @@ public IRubyObject to_s() {

@JRubyMethod(name = "to_s", alias = "inspect")
public IRubyObject to_s19() {
StringBuilder sb = new StringBuilder("#<Proc:0x" + Integer.toString(block.hashCode(), 16) + "@" +
block.getBody().getFile() + ":" + (block.getBody().getLine() + 1));
StringBuilder sb = new StringBuilder("#<Proc:0x" + Integer.toString(block.hashCode(), 16));
String file = block.getBody().getFile();

if (file != null) sb.append('@').append(file).append(':').append(block.getBody().getLine() + 1);

if (isLambda()) sb.append(" (lambda)");
sb.append(">");

IRubyObject string = RubyString.newString(getRuntime(), sb.toString());

if (isTaint()) string.setTaint(true);

return RubyString.newString(getRuntime(), sb.toString());
return string;
}

@JRubyMethod(name = "binding")
Expand Down
3 changes: 1 addition & 2 deletions test/mri/excludes/TestProc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
exclude :test_curry, "needs investigation"
exclude :test_curry_from_knownbug, "needs investigation"
exclude :test_curry_optional_params, "needs investigation"
exclude :test_curry_ski_fib, "needs investigation"
exclude :test_curry_with_trace, "needs investigation"
exclude :test_dup_clone, "needs investigation"
exclude :test_parameters, "needs investigation"
Expand All @@ -17,4 +16,4 @@
exclude :test_proc_args_pos_opt_post_block, "needs investigation"
exclude :test_proc_lambda, "needs investigation"
exclude :test_safe, "needs investigation"
exclude :test_to_s, "needs investigation"

0 comments on commit 5720901

Please sign in to comment.