Skip to content

Instantly share code, notes, and snippets.

@corbanbrook
Forked from anonymous/gist:1015357
Created June 8, 2011 21:34
Show Gist options
  • Save corbanbrook/1015468 to your computer and use it in GitHub Desktop.
Save corbanbrook/1015468 to your computer and use it in GitHub Desktop.
dumb max
def best_team(team_map)
best = nil
team_map.each {|x,team| if best == nil || team.win_loss_ratio() > best.win_loss_ratio()
best = team
end
}
best
end
@corbanbrook
Copy link
Author

team_map.map(&:win_loss_ratio).max

or

team_map.map { |t| t.win_loss_ratio }.max

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment