Skip to content

Commit

Permalink
Raise ArgumentError if count given to Array#first is negative
Browse files Browse the repository at this point in the history
  • Loading branch information
adambeynon committed Sep 20, 2013
1 parent ed94fc4 commit b5f907c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 5 additions & 0 deletions corelib/array.rb
Expand Up @@ -559,6 +559,11 @@ def fill(obj = undefined, &block)
def first(count = undefined)
%x{
if (count != null) {
if (count < 0) {
#{raise ArgumentError};
}
return #{self}.slice(0, count);
}
Expand Down
3 changes: 0 additions & 3 deletions spec/filters/bugs/array/first.rb

This file was deleted.

0 comments on commit b5f907c

Please sign in to comment.