lib/kyototycoon/cursor.rb in kyototycoon-0.6.0 vs lib/kyototycoon/cursor.rb in kyototycoon-0.6.1
- old
+ new
@@ -6,11 +6,11 @@
attr_reader :cur
def initialize(kt, cur)
@kt = kt
@cur = cur
- at_exit { delete! }
+ ObjectSpace.define_finalizer(self){delete!}
end
def each(&block)
return to_enum(:each) unless block_given?
jump if current == [nil,nil]
@@ -69,12 +69,12 @@
def current(step=nil)
res = request('/rpc/cur_get', {"step" => step})
[res["key"], res["value"]]
end
- def seize(xt=nil)
- res = request('/rpc/cur_seize', {"xt" => xt})
- [res["key"], res["value"]]
+ def seize
+ res = request('/rpc/cur_seize')
+ [res["key"], res["value"], (res["xt"].nil? ? nil : Time.at(res["xt"].to_i) )]
end
def remove
request('/rpc/cur_remove')
end