Skip to content

Commit

Permalink
[Truffle] Enumerable#{min, max} review update
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon Fish committed Sep 7, 2016
1 parent 9121a0e commit 3812700
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions truffle/src/main/ruby/core/enumerable.rb
Expand Up @@ -673,11 +673,7 @@ def min_n(n, &block)
raise ArgumentError, "negative size #{n}" if n < 0
return [] if n == 0

if block_given?
self.sort(&block).first(n)
else
self.sort.first(n)
end
self.sort(&block).first(n)
end
private :min_n

Expand Down Expand Up @@ -709,11 +705,7 @@ def max_n(n, &block)
raise ArgumentError, "negative size #{n}" if n < 0
return [] if n == 0

if block_given?
self.sort(&block).reverse.first(n)
else
self.sort.reverse.first(n)
end
self.sort(&block).reverse.first(n)
end
private :max_n

Expand Down

0 comments on commit 3812700

Please sign in to comment.