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

Commits on May 24, 2015

  1. Copy the full SHA
    6e5b4e9 View commit details
  2. Merge pull request #893 from vais/enumerator-with-index

    Enumerator#with_index fully compliant with rubyspec
    meh committed May 24, 2015
    Copy the full SHA
    2dce252 View commit details
Showing with 2 additions and 9 deletions.
  1. +2 −2 opal/corelib/enumerator.rb
  2. +0 −7 spec/filters/bugs/enumerator.rb
4 changes: 2 additions & 2 deletions opal/corelib/enumerator.rb
Original file line number Diff line number Diff line change
@@ -59,7 +59,7 @@ def with_index(offset = 0, &block)
return enum_for :with_index, offset unless block

%x{
var result, index = 0;
var result, index = offset;
self.$each.$$p = function() {
var param = #{Opal.destructure(`arguments`)},
@@ -79,7 +79,7 @@ def with_index(offset = 0, &block)
return result;
}
return nil;
return self.object;
}
end

7 changes: 0 additions & 7 deletions spec/filters/bugs/enumerator.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
opal_filter "Enumerator" do
fails "Enumerator#each requires multiple arguments" # arity issue

fails "Enumerator#with_index returns the object being enumerated when given a block"
fails "Enumerator#with_index numbers indices from the given index when given an offset but no block"
fails "Enumerator#with_index numbers indices from the given index when given an offset and block"
fails "Enumerator#with_index converts non-numeric arguments to Integer via #to_int"
fails "Enumerator#with_index coerces the given numeric argument to an Integer"
fails "Enumerator#with_index accepts negative argument"
end