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: opal/opal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0d006ad18775
Choose a base ref
...
head repository: opal/opal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 805bee79b7cd
Choose a head ref
  • 2 commits
  • 2 files changed
  • 2 contributors

Commits on May 18, 2015

  1. Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    59fddf2 View commit details
  2. Merge pull request #873 from vais/fix-issue-871

    Fix issue #871
    elia committed May 18, 2015

    Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    805bee7 View commit details
Showing with 14 additions and 7 deletions.
  1. +14 −4 opal/corelib/array.rb
  2. +0 −3 spec/filters/bugs/array.rb
18 changes: 14 additions & 4 deletions opal/corelib/array.rb
Original file line number Diff line number Diff line change
@@ -1780,12 +1780,22 @@ def values_at(*args)

def zip(*others, &block)
%x{
var result = [], size = self.length, part, o;
var result = [], size = self.length, part, o, i, j, jj;
for (var i = 0; i < size; i++) {
for (j = 0, jj = others.length; j < jj; j++) {
o = others[j];
if (!o.$$is_array) {
others[j] = #{(
Opal.coerce_to?(`o`, Array, :to_ary) ||
Opal.coerce_to!(`o`, Enumerator, :each)
).to_a};
}
}
for (i = 0; i < size; i++) {
part = [self[i]];
for (var j = 0, jj = others.length; j < jj; j++) {
for (j = 0, jj = others.length; j < jj; j++) {
o = others[j][i];
if (o == null) {
@@ -1799,7 +1809,7 @@ def zip(*others, &block)
}
if (block !== nil) {
for (var i = 0; i < size; i++) {
for (i = 0; i < size; i++) {
block(result[i]);
}
3 changes: 0 additions & 3 deletions spec/filters/bugs/array.rb
Original file line number Diff line number Diff line change
@@ -140,9 +140,6 @@

fails "Array#uniq! compares elements based on the value returned from the block"

fails "Array#zip calls #to_ary to convert the argument to an Array"
fails "Array#zip uses #each to extract arguments' elements when #to_ary fails"

fails "Array#hash returns the same fixnum for arrays with the same content"

fails "Array#partition returns in the left array values for which the block evaluates to true"