lib/fakeredis/zset.rb in fakeredis-0.5.0 vs lib/fakeredis/zset.rb in fakeredis-0.6.0
- old
+ new
@@ -3,10 +3,14 @@
def []=(key, val)
super(key, _floatify(val))
end
+ def identical_scores?
+ values.uniq.size == 1
+ end
+
# Increments the value of key by val
def increment(key, val)
self[key] += _floatify(val)
end
@@ -23,11 +27,13 @@
if (( inf = str.to_s.match(/^([+-])?inf/i) ))
(inf[1] == "-" ? -1.0 : 1.0) / 0.0
elsif (( number = str.to_s.match(/^\((\d+)/i) ))
number[1].to_i + (increment ? 1 : -1)
else
- Float str
+ Float str.to_s
end
+ rescue ArgumentError
+ raise Redis::CommandError, "ERR value is not a valid float"
end
end
end