Class: Lunar::SortedResultSet

Inherits:
ResultSet show all
Defined in:
lib/lunar/result_set.rb

Instance Attribute Summary

Attributes inherited from ResultSet

#key

Instance Method Summary collapse

Methods inherited from ResultSet

#each, #initialize

Constructor Details

This class inherits a constructor from Lunar::ResultSet

Instance Method Details

#all(options = {}) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/lunar/result_set.rb', line 18

def all(options = {})
  start  = Integer(options[:start] || 0)
  limit  = Integer(options[:limit] || 0)
  finish = start + limit - 1
  
  Lunar.redis.zrevrange(key, start, finish).map(&@block)
end

#sizeObject



26
27
28
# File 'lib/lunar/result_set.rb', line 26

def size
  Lunar.redis.zcard(key)
end