Advertisement
Guest User

Untitled

a guest
Jun 25th, 2012
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. How can I run enumberable
  2. and only do min_by on a collection with
  3. certain other variables met?
  4.  
  5. Example..
  6.  
  7. @array.min_by{|ele| ele[:failed] < MaxFailedAllowed ; ele[:last_used] } #<--- in this instance I really want
  8. the lowest :last_used element, but only if its less that max failed as well.. do I have to do
  9. a find_all to collect the first elements then do a min_by on that? or is there
  10. a way to combine the 2 comparisons?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement