Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: b3b5d1172b92
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: d22e0f0df015
Choose a head ref
  • 5 commits
  • 5 files changed
  • 1 contributor

Commits on Nov 22, 2016

  1. Copy the full SHA
    52b3699 View commit details
  2. Copy the full SHA
    773bf56 View commit details
  3. Copy the full SHA
    b7a0d38 View commit details
  4. Copy the full SHA
    2253241 View commit details
  5. Copy the full SHA
    d22e0f0 View commit details
9 changes: 5 additions & 4 deletions core/src/main/java/org/jruby/RubyBignum.java
Original file line number Diff line number Diff line change
@@ -269,13 +269,14 @@ public RubyString to_s(IRubyObject arg0) {
*/
@Override
public IRubyObject coerce(IRubyObject other) {
Ruby runtime = getRuntime();
if (other instanceof RubyFixnum) {
return getRuntime().newArray(newBignum(getRuntime(), ((RubyFixnum) other).getLongValue()), this);
return runtime.newArray(newBignum(runtime, ((RubyFixnum) other).getLongValue()), this);
} else if (other instanceof RubyBignum) {
return getRuntime().newArray(newBignum(getRuntime(), ((RubyBignum) other).getValue()), this);
}
return runtime.newArray(newBignum(runtime, ((RubyBignum) other).getValue()), this);
}

throw getRuntime().newTypeError("Can't coerce " + other.getMetaClass().getName() + " to Bignum");
return RubyArray.newArray(runtime, RubyKernel.new_float(this, other), RubyKernel.new_float(this, this));
}

/** rb_big_uminus
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/RubyEnumerable.java
Original file line number Diff line number Diff line change
@@ -2003,7 +2003,7 @@ public static IRubyObject chunk(ThreadContext context, IRubyObject self, final I
@JRubyMethod
public static IRubyObject chunk(ThreadContext context, IRubyObject self, final Block block) {
if(!block.isGiven()) {
throw context.runtime.newArgumentError("no block given");
return enumeratorize(context.runtime, self, "chunk");
}

IRubyObject enumerator = context.runtime.getEnumerator().allocate();
9 changes: 7 additions & 2 deletions core/src/main/java/org/jruby/RubySymbol.java
Original file line number Diff line number Diff line change
@@ -406,12 +406,17 @@ public IRubyObject casecmp(ThreadContext context, IRubyObject other) {
newShared(runtime).casecmp19(context, ((RubySymbol) other).newShared(runtime));
}

@JRubyMethod(name = {"=~", "match"})
@JRubyMethod(name = "=~")
@Override
public IRubyObject op_match19(ThreadContext context, IRubyObject other) {
public IRubyObject op_match(ThreadContext context, IRubyObject other) {
return newShared(context.runtime).op_match19(context, other);
}

@JRubyMethod(name = "match")
public IRubyObject match_m(ThreadContext context, IRubyObject other, Block block) {
return newShared(context.runtime).match19(context, other, block);
}

@JRubyMethod(name = {"[]", "slice"})
public IRubyObject op_aref(ThreadContext context, IRubyObject arg) {
return newShared(context.runtime).op_aref19(context, arg);
29 changes: 18 additions & 11 deletions core/src/main/java/org/jruby/util/StringSupport.java
Original file line number Diff line number Diff line change
@@ -824,15 +824,18 @@ public static ByteList dumpCommon(Ruby runtime, ByteList byteList) {
if (ASCIIEncoding.INSTANCE.isPrint(c)) {
len++;
} else {
if (enc.isUTF8()) {
if (enc.isUTF8() && c > 0x7F) {
int n = preciseLength(enc, bytes, p - 1, end) - 1;
if (n > 0) {
if (buf == null) buf = new ByteList();
if (MBCLEN_CHARFOUND_LEN(n) > 0) {
int cc = codePoint(runtime, enc, bytes, p - 1, end);
Sprintf.sprintf(runtime, buf, "%x", cc);
len += buf.getRealSize() + 4;
buf.setRealSize(0);
p += n;
if (cc <= 0xFFFF) {
len += 6;
} else if (cc <= 0xFFFFF) {
len += 9;
} else {
len += 10;
}
p += MBCLEN_CHARFOUND_LEN(n) - 1;
break;
}
}
@@ -889,18 +892,22 @@ public static ByteList dumpCommon(Ruby runtime, ByteList byteList) {
out[q++] = (byte)c;
} else {
out[q++] = '\\';
outBytes.setRealSize(q);
if (enc.isUTF8()) {
int n = preciseLength(enc, bytes, p - 1, end) - 1;
if (n > 0) {
if (MBCLEN_CHARFOUND_LEN(n) > 0) {
int cc = codePoint(runtime, enc, bytes, p - 1, end);
p += n;
outBytes.setRealSize(q);
Sprintf.sprintf(runtime, outBytes, "u{%x}", cc);
p += n;
if (cc <= 0xFFFF) {
Sprintf.sprintf(runtime, outBytes, "u%04X", cc);
} else {
Sprintf.sprintf(runtime, outBytes, "u{%X}", cc);
}
q = outBytes.getRealSize();
continue;
}
}
outBytes.setRealSize(q);
Sprintf.sprintf(runtime, outBytes, "x%02X", c);
q = outBytes.getRealSize();
}
2 changes: 1 addition & 1 deletion core/src/main/ruby/jruby/kernel/signal.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Signal
def trap(sig, cmd = nil, &block)
sig = SIGNALS[sig] if sig.kind_of?(Fixnum)
sig = SIGNALS[sig] if sig.kind_of?(Integer)
sig = sig.to_s.sub(/^SIG(.+)/,'\1')

if RESERVED_SIGNALS.include?(sig)