Returns a hash suitable for sending to Redis.new. The hash is generated from the host, port, db and password from the URI as well as any query vars.
e.g.
uri = URI.parse "redis://127.0.0.1/6/?timeout=5" uri.conf # => {:db=>6, :timeout=>"5", :host=>"127.0.0.1", :port=>6379}
# File lib/uri/redis.rb, line 55 def conf hsh = { :host => host, :port => port, :db => db }.merge parse_query(query) hsh[:password] = password if password hsh end
# File lib/uri/redis.rb, line 33 def db self.path ||= "/#{DEFAULT_DB}" (self.path.split('/')[1] || DEFAULT_DB).to_i end
# File lib/uri/redis.rb, line 38 def db=(val) current_key = key self.path = "/#{val}" self.path << "/#{current_key}" self.path end
# File lib/uri/redis.rb, line 23 def key return if self.path.nil? self.path ||= "/#{DEFAULT_DB}" (self.path.split('/')[2..-1] || []).join('/') end
# File lib/uri/redis.rb, line 29 def key=(val) self.path = '/' << [db, val].join('/') end
Generated with the Darkfish Rdoc Generator 2.