Skip to content

Commit

Permalink
String#-@ always deduplicates in 2.5+.
Browse files Browse the repository at this point in the history
  • Loading branch information
headius committed Apr 24, 2018
1 parent 13e2499 commit 5441086
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/src/main/java/org/jruby/RubyString.java
Original file line number Diff line number Diff line change
Expand Up @@ -1141,9 +1141,9 @@ private IRubyObject op_equalCommon(ThreadContext context, IRubyObject other) {
return sites(context).equals.call(context, this, other, this).isTrue() ? runtime.getTrue() : runtime.getFalse();
}

@JRubyMethod(name = "-@") // -'foo' returns frozen string
@JRubyMethod(name = "-@") // -'foo' returns deduplicated (interned) string
public final IRubyObject minus_at(ThreadContext context) {
return isFrozen() ? this : context.runtime.freezeAndDedupString(this);
return context.runtime.freezeAndDedupString(this);
}

@JRubyMethod(name = "+@") // +'foo' returns modifiable string
Expand Down

0 comments on commit 5441086

Please sign in to comment.