lib/fakeredis.rb in fakeredis-0.1.1 vs lib/fakeredis.rb in fakeredis-0.1.2
- old
+ new
@@ -1,15 +1,48 @@
module FakeRedis
class Redis
+ class Client
+ attr_accessor :host, :port, :db, :path, :password, :logger, :reconnect
+ def initialize(options = {})
+ @path = options[:path]
+ @host = options[:host] || "127.0.0.1"
+ @port = (options[:port] || 6379).to_i
+ @password = options[:password]
+ @db = (options[:db] || 0).to_i
+ @logger = options[:logger]
+ @reconnect = true
+ end
+ def id
+ "redis://#{@host}:#{@port}/#{@db}"
+ end
+
+ def connect
+ self
+ end
+
+ def connected?
+ true
+ end
+
+ def method_missing(command, *args, &block)
+ true
+ end
+ end
+
def self.connect(options = {})
new(options)
end
def initialize(options = {})
@data = {}
@expires = {}
+ @client = Client.new(options)
+ end
+
+ def client
+ @client
end
end
end
require 'set'