module RedisOrm::Utils
Public Instance Methods
calculate_key_for_zset(string)
click to toggle source
# File lib/redis_orm/utils.rb 3 def calculate_key_for_zset(string) 4 return 0.0 if string.nil? 5 sum = "" 6 string.codepoints.each do |codepoint| 7 sum += ("%05i" % codepoint.to_s) # 5 because 65536 => 2 bytes UTF-8 8 end 9 "0.#{sum}".to_f 10 end