Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Merge branch 'master' of github.com:topazproject/topaz
- Loading branch information
|
@@ -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 |
|
|