Skip to content

Commit

Permalink
Fix Enumerable#find_index when not given object or block
Browse files Browse the repository at this point in the history
  • Loading branch information
adambeynon committed Sep 20, 2013
1 parent 2b7d694 commit 1f1b40a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 4 additions & 1 deletion corelib/enumerable.rb
Expand Up @@ -372,7 +372,7 @@ def find_index(object = undefined, &block)
index += 1;
};
}
else {
else if (block !== nil) {
proc = function() {
var value;
var param = arguments.length == 1 ?
Expand All @@ -392,6 +392,9 @@ def find_index(object = undefined, &block)
index += 1;
};
}
else {
return #{enum_for :find_index};
}
#{self}.$each._p = proc;
#{self}.$each();
Expand Down
1 change: 0 additions & 1 deletion spec/filters/bugs/enumerable.rb
Expand Up @@ -21,7 +21,6 @@

fails "Enumerable#each_with_object returns an enumerator if no block"

fails "Enumerable#find_index returns an Enumerator if no block given"
fails "Enumerable#find_index gathers initial args as elements when each yields multiple"
fails "Enumerable#grep can use $~ in the block when used with a Regexp"

Expand Down

0 comments on commit 1f1b40a

Please sign in to comment.