We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
<
1 parent f5a86ca commit 9e2faecCopy full SHA for 9e2faec
mrbgems/mruby-enum-ext/mrblib/enum.rb
@@ -58,9 +58,8 @@ def drop_while(&block)
58
59
def take(n)
60
raise TypeError, "no implicit conversion of #{n.class} into Integer" unless n.respond_to?(:to_int)
61
- raise ArgumentError, "attempt to take negative size" if n < 0
62
-
63
- n = n.to_int
+ i = n.to_int
+ raise ArgumentError, "attempt to take negative size" if i < 0
64
ary = []
65
self.each do |*val|
66
break if ary.size >= n
0 commit comments