lib/leaderboard.rb in leaderboard-3.5.0 vs lib/leaderboard.rb in leaderboard-3.6.0
- old
+ new
@@ -12,11 +12,12 @@
:page_size => DEFAULT_PAGE_SIZE,
:reverse => false,
:member_key => :member,
:rank_key => :rank,
:score_key => :score,
- :member_data_key => :member_data
+ :member_data_key => :member_data,
+ :member_data_namespace => 'member_data'
}
# Default Redis host: localhost
DEFAULT_REDIS_HOST = 'localhost'
@@ -76,10 +77,11 @@
end
@member_key = leaderboard_options[:member_key]
@rank_key = leaderboard_options[:rank_key]
@score_key = leaderboard_options[:score_key]
@member_data_key = leaderboard_options[:member_data_key]
+ @member_data_namespace = leaderboard_options[:member_data_namespace]
@redis_connection = redis_options[:redis_connection]
unless @redis_connection.nil?
redis_options.delete(:redis_connection)
end
@@ -970,10 +972,10 @@
#
# @param leaderboard_name [String] Name of the leaderboard.
#
# @return a key in the form of +leaderboard_name:member_data+
def member_data_key(leaderboard_name)
- "#{leaderboard_name}:member_data"
+ "#{leaderboard_name}:#{@member_data_namespace}"
end
# Validate and return the page size. Returns the +DEFAULT_PAGE_SIZE+ if the page size is less than 1.
#
# @param page_size [int] Page size.
\ No newline at end of file