Skip to content

Commit

Permalink
Array#fetch now gives precedence to default block over default argument
Browse files Browse the repository at this point in the history
This is rubyspec compliant, and fixes 1 filtered spec
  • Loading branch information
adambeynon committed Sep 20, 2013
1 parent b5f907c commit e80a425
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
8 changes: 4 additions & 4 deletions corelib/array.rb
Expand Up @@ -527,14 +527,14 @@ def fetch(index, defaults = undefined, &block)
return #{self}[index];
}
if (defaults != null) {
return defaults;
}
if (block !== nil) {
return block(original);
}
if (defaults != null) {
return defaults;
}
#{ raise IndexError, "Array#fetch" };
}
end
Expand Down
3 changes: 0 additions & 3 deletions spec/filters/bugs/array/fetch.rb

This file was deleted.

0 comments on commit e80a425

Please sign in to comment.