class Redis
def zrange(key, start, stop, options = {})
-
(Array
-, Array<[String, Float]>)
Parameters:
-
options
(Hash
) -- -
stop
(Fixnum
) -- stop index -
start
(Fixnum
) -- start index -
key
(String
) --
Other tags:
- Example: Retrieve all members and their scores from a sorted set -
Example: Retrieve all members from a sorted set -
def zrange(key, start, stop, options = {}) args = [] with_scores = options[:with_scores] || options[:withscores] args << "WITHSCORES" if with_scores synchronize do |client| client.call [:zrange, key, start, stop, *args] do |reply| if with_scores if reply reply.each_slice(2).map do |member, score| [member, Float(score)] end end else reply end end end end