# # issue with setlimit(max, skip) # # # sudo gem install rufus-tokyo # require 'rubygems' require 'rufus/tokyo' t = Rufus::Tokyo::Table.new('table.tct') t['pk0'] = { 'name' => 'alfred', 'age' => '22' } t['pk1'] = { 'name' => 'bob', 'age' => '18' } t['pk2'] = { 'name' => 'charly', 'age' => '45' } t['pk3'] = { 'name' => 'doug', 'age' => '77' } t['pk4'] = { 'name' => 'ephrem', 'age' => '32' } MAX = 2 puts 5.times do |i| count = t.query { |q| q.limit MAX, i }.size puts " (limit only) setlimit(#{MAX}, #{i}) --> #{count} rows" end puts 5.times do |i| count = t.query { |q| q.order_by 'name', :desc q.limit MAX, i }.size puts " (order and limit) setlimit(#{MAX}, #{i}) --> #{count} rows" end t.close