agoragames / leaderboard

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

Define top(number) helper method #50

Closed robertomiranda closed 9 years ago

robertomiranda commented 9 years ago

I just wanted to add a shorthand for get top_10 of a specific leaderboard, but this cover a general way:

leaderboard.top_10
leaderboard.top_5

I'll add the test cases and proper document if this method fit with the library

czarneckid commented 9 years ago

@robertomiranda After thinking about this a bit more, I think I'd rather see explicit .top(number) and .top_in(leaderboard_name, number) methods that would do the same thing. This will be helpful when I go to port the functionality over to the Python and JavaScript versions of the library.

robertomiranda commented 9 years ago

@czarneckid make more sense :+1:

robertomiranda commented 9 years ago

@czarneckid done :grin:

czarneckid commented 9 years ago

Looks good. Could you please round out the specs to cover the other leaderboard types (reverse option, Tie and Competition)?

czarneckid commented 9 years ago

And if you wouldn't mind squashing the commits after you're all done, that'd be great. Thanks in advance.

robertomiranda commented 9 years ago

@czarneckid done!

czarneckid commented 9 years ago

I'll look at this more in-depth over the next few days, but otherwise things look great. I may add some more specs that add more tie scores to the tie and competition ranking leaderboard types.

robertomiranda commented 9 years ago

@czarneckid any other suggestion?

czarneckid commented 9 years ago

No. I've got some time over the next week to get this integrated. Sorry it's been awhile. End of year, holidays and getting back into the swing of things here at work.

robertomiranda commented 9 years ago

sure np :+1:, I was just wondering :smile: