Skip to content

Commit

Permalink
:with_data to :with_member_data to be consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
David Czarnecki committed Jun 9, 2012
1 parent 5d22b29 commit 35a539f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.markdown
Expand Up @@ -150,7 +150,7 @@ Get page 1 in the leaderboard:
```

You can pass various options to the calls `leaders`, `around_me` and `ranked_in_list`.
Valid options are `:with_scores`, `:with_rank`, `:with_data`, `:use_zero_index_for_rank`
Valid options are `:with_scores`, `:with_rank`, `:with_member_data`, `:use_zero_index_for_rank`
and `:page_size`. Below is an example of retrieving the first page in the leaderboard
without ranks:

Expand Down
6 changes: 3 additions & 3 deletions lib/leaderboard.rb
Expand Up @@ -29,13 +29,13 @@ class Leaderboard
# Default options when requesting data from a leaderboard.
# +:with_scores+ true: Return scores along with the member names.
# +:with_rank+ true: Return ranks along with the member names.
# +:with_data+ false: Return member data along with the member names.
# +:with_member_data+ false: Return member data along with the member names.
# +:use_zero_index_for_rank+ false: If you want to 0-index ranks.
# +:page_size+ nil: The default page size will be used.
DEFAULT_LEADERBOARD_REQUEST_OPTIONS = {
:with_scores => true,
:with_rank => true,
:with_data => false,
:with_member_data => false,
:use_zero_index_for_rank => false,
:page_size => nil
}
Expand Down Expand Up @@ -638,7 +638,7 @@ def ranked_in_list_in(leaderboard_name, members, options = {})
end
end

if leaderboard_options[:with_data]
if leaderboard_options[:with_member_data]
data[:member_data] = member_data_for_in(leaderboard_name, member)
end

Expand Down
2 changes: 1 addition & 1 deletion spec/leaderboard_spec.rb
Expand Up @@ -143,7 +143,7 @@
rank_members_in_leaderboard(Leaderboard::DEFAULT_PAGE_SIZE)

@leaderboard.total_members.should be(Leaderboard::DEFAULT_PAGE_SIZE)
leaders = @leaderboard.leaders(1, {:with_scores => false, :with_rank => false, :with_data => true})
leaders = @leaderboard.leaders(1, {:with_scores => false, :with_rank => false, :with_member_data => true})

member_25 = {:member => 'member_25', :member_data => { "member_name" => "Leaderboard member 25" }}
leaders[0].should == member_25
Expand Down

0 comments on commit 35a539f

Please sign in to comment.