In Files

Parent

Class/Module Index [+]

Quicksearch

URI::Redis

Public Class Methods

build(args) click to toggle source
# File lib/uri/redis.rb, line 10
def self.build(args)
  tmp = Util::make_components_hash(self, args)
  return super(tmp)
end
new(*arg) click to toggle source
# File lib/uri/redis.rb, line 15
def initialize(*arg)
  super(*arg)
end

Public Instance Methods

conf() click to toggle source

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
db() click to toggle source
# File lib/uri/redis.rb, line 33
def db
  self.path ||= "/#{DEFAULT_DB}"
  (self.path.split('/')[1] || DEFAULT_DB).to_i
end
db=(val) click to toggle source
# File lib/uri/redis.rb, line 38
def db=(val)
  current_key = key
  self.path = "/#{val}"
  self.path << "/#{current_key}"
  self.path
end
key() click to toggle source
# 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
key=(val) click to toggle source
# File lib/uri/redis.rb, line 29
def key=(val)
  self.path = '/' << [db, val].join('/')
end
request_uri() click to toggle source
# File lib/uri/redis.rb, line 19
def request_uri
  r = path_query
end
serverid() click to toggle source
# File lib/uri/redis.rb, line 65
def serverid
  'redis://%s:%s/%s' % [host, port, db]
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.