lib/hotseat/queue.rb in hotseat-0.4.0 vs lib/hotseat/queue.rb in hotseat-0.5.0
- old
+ new
@@ -129,11 +129,12 @@
def num_pending
@db.view(pending_view_name, :limit => 0)['total_rows']
end
alias :size :num_pending
- def get(n=1)
- rows = @db.view(pending_view_name, :limit => n, :include_docs => true)['rows']
+ def get(n=1, as_stack=false)
+ params = {:limit => n, :include_docs => true, :descending => as_stack}
+ rows = @db.view(pending_view_name, params)['rows']
rows.map{|row| row['doc']} unless rows.empty?
end
def lease(n=1)
if docs = get(n)