mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Support object does'n have < method
This commit is contained in:
@@ -58,9 +58,8 @@ module Enumerable
|
||||
|
||||
def take(n)
|
||||
raise TypeError, "no implicit conversion of #{n.class} into Integer" unless n.respond_to?(:to_int)
|
||||
raise ArgumentError, "attempt to take negative size" if n < 0
|
||||
|
||||
n = n.to_int
|
||||
i = n.to_int
|
||||
raise ArgumentError, "attempt to take negative size" if i < 0
|
||||
ary = []
|
||||
self.each do |*val|
|
||||
break if ary.size >= n
|
||||
|
||||
Reference in New Issue
Block a user