class Ohm::SortedSet
Public Instance Methods
[](id)
click to toggle source
# File lib/ohm/sorted.rb, line 118 def [](id) model[id] if !!db.zrank(key, id) end
all()
click to toggle source
# File lib/ohm/sorted.rb, line 126 def all ids.map(&model) end
each(&block)
click to toggle source
# File lib/ohm/sorted.rb, line 113 def each(&block) return to_enum(:each) unless block ids.each { |id| block.call(model.to_proc[id]) } end
empty?()
click to toggle source
# File lib/ohm/sorted.rb, line 122 def empty? size == 0 end
include?(model)
click to toggle source
# File lib/ohm/sorted.rb, line 130 def include?(model) !!db.zrank(key, model.id) end
Private Instance Methods
db()
click to toggle source
# File lib/ohm/sorted.rb, line 101 def db model.db end
execute() { |key| ... }
click to toggle source
# File lib/ohm/sorted.rb, line 97 def execute yield key end
exists?(id)
click to toggle source
# File lib/ohm/sorted.rb, line 93 def exists?(id) execute { |key| !!db.zscore(key, id) } end