agoragames / leaderboard

Leaderboards backed by Redis in Ruby
https://rubygems.org/gems/leaderboard
MIT License
478 stars 65 forks source link

Version 3 proposal: Add a `:sort_by` option #30

Closed czarneckid closed 11 years ago

czarneckid commented 11 years ago

As indicated in #29, the currently undocumented behavior of a direct call to ranked_in_list is to do no sorting on the results. The call was originally intended to be used to retrieve a list of friends from a leaderboard. However, it would be useful in certain situations to have the results sorted. This adds a :sort_by option to that would be appropriate for the ranked_in_list call to sort by either score (:score) or rank (:rank) when returning results.

czarneckid commented 11 years ago

This code has been integrated into the version 3 branch.