Skip to content
Permalink
Browse files

Merge branch 'master' of github.com:topazproject/topaz

  • Loading branch information
Alex Gaynor
Alex Gaynor committed Mar 19, 2013
2 parents 1d99d30 + 131b97a commit 616bdedf624ac15807e7b7eaa7e03ca57012fb27
Showing with 20 additions and 6 deletions.
  1. +20 −0 lib-topaz/enumerable.rb
  2. +0 −3 spec/tags/core/enumerable/max_tags.txt
  3. +0 −3 spec/tags/core/enumerable/min_tags.txt
@@ -148,4 +148,24 @@ def reject(&block)
end
result
end

def min
inject do |minimum, current|
if minimum > current
current
else
minimum
end
end
end

def max
inject do |maximum, current|
if maximum < current
current
else
maximum
end
end
end
end
@@ -1,6 +1,3 @@
fails:Enumerable#max max should return the maximum element
fails:Enumerable#max return the maximum element (basics cases)
fails:Enumerable#max returns nil for an empty Enumerable
fails:Enumerable#max raises an ArgumentError for incomparable elements
fails:Enumerable#max return the maximum element (with block
fails:Enumerable#max returns the minimum for enumerables that contain nils
@@ -1,6 +1,3 @@
fails:Enumerable#min min should return the minimum element
fails:Enumerable#min return the minimun (basic cases)
fails:Enumerable#min returns nil for an empty Enumerable
fails:Enumerable#min raises an ArgumentError for incomparable elements
fails:Enumerable#min return the minimun when using a block rule
fails:Enumerable#min returns the minimum for enumerables that contain nils

0 comments on commit 616bded

Please sign in to comment.