Skip to content

Instantly share code, notes, and snippets.

@jeffkreeftmeijer
Created February 16, 2011 19:59
Show Gist options
  • Save jeffkreeftmeijer/830060 to your computer and use it in GitHub Desktop.
Save jeffkreeftmeijer/830060 to your computer and use it in GitHub Desktop.
Ranking scores
scores = [10, 9, 9, 8]
rankings = scores.map { |score| scores.index(score) + 1 }
puts scores.inspect # => [10, 9, 9, 8]
puts rankings.inspect # => [1, 2, 2, 4]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment