Permalink
Browse files

Support object does'n have `<` method

  • Loading branch information...
ksss committed Nov 24, 2016
1 parent f5a86ca commit 9e2faec8e4f5cb24ffc8a7f10284c05598b91acd
Showing with 2 additions and 3 deletions.
  1. +2 −3 mrbgems/mruby-enum-ext/mrblib/enum.rb
@@ -58,9 +58,8 @@ def drop_while(&block)
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

0 comments on commit 9e2faec

Please sign in to comment.