Method: Redis#zrange
- Defined in:
- lib/redis.rb
#zrange(key, start, stop, options = {}) ⇒ Array<String>, Array<[String, Float]>
Return a range of members in a sorted set, by index.
921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 |
# File 'lib/redis.rb', line 921 def zrange(key, start, stop, = {}) args = [] with_scores = [:with_scores] || [:withscores] args << "WITHSCORES" if with_scores synchronize do @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 |