mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Shouldn't call each method if size is 0
This commit is contained in:
@@ -61,9 +61,11 @@ module Enumerable
|
||||
i = n.to_int
|
||||
raise ArgumentError, "attempt to take negative size" if i < 0
|
||||
ary = []
|
||||
return ary if i == 0
|
||||
self.each do |*val|
|
||||
break if ary.size >= n
|
||||
ary << val.__svalue
|
||||
i -= 1
|
||||
break if i == 0
|
||||
end
|
||||
ary
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user