Created
January 23, 2011 17:23
-
-
Save czarneckid/792239 to your computer and use it in GitHub Desktop.
Scenario 1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fossil:leaderboard dczarnecki$ irb | |
ruby-1.8.7-p302 > require 'rubygems' | |
=> true | |
ruby-1.8.7-p302 > require 'leaderboard' | |
=> true | |
ruby-1.8.7-p302 > highscore_lb = Leaderboard.new('highscores') | |
=> #<Leaderboard:0x1011b23b0 @leaderboard_name="highscores", @page_size=25, @port=6379, @redis_connection=#<Redis client v2.1.1 connected to redis://localhost:6379/0 (Redis v2.0.4)>, @host="localhost", @redis_options={:host=>"localhost", :port=>6379}> | |
ruby-1.8.7-p302 > 1.upto(10) do |index| | |
ruby-1.8.7-p302 > highscore_lb.add_member("member_#{index}", index) | |
ruby-1.8.7-p302 ?> end | |
=> 1 | |
ruby-1.8.7-p302 > highscore_lb.add_member('DavidCzarnecki', 6) | |
=> true | |
ruby-1.8.7-p302 > highscore_lb.page_size = 5 | |
=> 5 | |
ruby-1.8.7-p302 > highscore_lb.around_me('DavidCzarnecki') | |
=> [{:member=>"member_7", :score=>"7", :rank=>4}, {:member=>"member_6", :score=>"6", :rank=>5}, {:member=>"DavidCzarnecki", :score=>"6", :rank=>6}, {:member=>"member_5", :score=>"5", :rank=>7}, {:member=>"member_4", :score=>"4", :rank=>8}] | |
ruby-1.8.7-p302 > |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment