Skip to content

Commit 9e2faec

Browse files
committed
Support object does'n have < method
1 parent f5a86ca commit 9e2faec

File tree

1 file changed

+2
-3
lines changed
  • mrbgems/mruby-enum-ext/mrblib

1 file changed

+2
-3
lines changed

mrbgems/mruby-enum-ext/mrblib/enum.rb

+2-3
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,8 @@ def drop_while(&block)
5858

5959
def take(n)
6060
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
61+
i = n.to_int
62+
raise ArgumentError, "attempt to take negative size" if i < 0
6463
ary = []
6564
self.each do |*val|
6665
break if ary.size >= n

0 commit comments

Comments
 (0)