class RedisFile::ZSet

Public Instance Methods

[]=(key, val) click to toggle source
Calls superclass method
# File lib/redis-file/zset.rb, line 4
def []=(key, val)
  super(key, _floatify(val))
end
_floatify(str) click to toggle source

Originally lifted from redis-rb

# File lib/redis-file/zset.rb, line 20
def _floatify(str)
  if (( inf = str.to_s.match(/^([+-])?inf/i) ))
    (inf[1] == "-" ? -1.0 : 1.0) / 0.0
  else
    Float str
  end
end
increment(key, val) click to toggle source

Increments the value of key by val

# File lib/redis-file/zset.rb, line 9
def increment(key, val)
  self[key] += _floatify(val)
end
select_by_score(min, max) click to toggle source
# File lib/redis-file/zset.rb, line 13
def select_by_score min, max
  min = _floatify(min)
  max = _floatify(max)
  reject {|_,v| v < min || v > max }
end