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: 60cc2ef5d7a5
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 425743f0d865
Choose a head ref
  • 2 commits
  • 1 file changed
  • 2 contributors

Commits on Jan 4, 2018

  1. Copy the full SHA
    8ab6ec8 View commit details
  2. Merge pull request #4935 from ChrisBr/feature/array-alias25

    Implement Array#prepend and Array#append aliases
    enebo authored Jan 4, 2018
    Copy the full SHA
    425743f View commit details
Showing with 5 additions and 5 deletions.
  1. +5 −5 core/src/main/java/org/jruby/RubyArray.java
10 changes: 5 additions & 5 deletions core/src/main/java/org/jruby/RubyArray.java
Original file line number Diff line number Diff line change
@@ -1263,14 +1263,14 @@ public RubyArray push_m(IRubyObject[] items) {
return push(items);
}

@JRubyMethod(name = "push", required = 1)
@JRubyMethod(name = "push", alias = "append", required = 1)
public RubyArray push(IRubyObject item) {
append(item);

return this;
}

@JRubyMethod(name = "push", rest = true)
@JRubyMethod(name = "push", alias = "append", rest = true)
public RubyArray push(IRubyObject[] items) {
if (items.length == 0) modifyCheck();
for (int i = 0; i < items.length; i++) {
@@ -1341,7 +1341,7 @@ public IRubyObject shift(ThreadContext context, IRubyObject num) {
return result;
}

@JRubyMethod(name = "unshift")
@JRubyMethod(name = "unshift", alias = "prepend")
public IRubyObject unshift() {
modifyCheck();
return this;
@@ -1355,7 +1355,7 @@ public IRubyObject unshift19() {
/** rb_ary_unshift
*
*/
@JRubyMethod(name = "unshift")
@JRubyMethod(name = "unshift", alias = "prepend")
public IRubyObject unshift(IRubyObject item) {
unpack();
modifyCheck();
@@ -1390,7 +1390,7 @@ public IRubyObject unshift19(IRubyObject item) {
return unshift(item);
}

@JRubyMethod(name = "unshift", rest = true)
@JRubyMethod(name = "unshift", alias = "prepend", rest = true)
public IRubyObject unshift(IRubyObject[] items) {
unpack();
modifyCheck();