lib/fakeredis.rb in fakeredis-0.1.4 vs lib/fakeredis.rb in fakeredis-0.2.0
- old
+ new
@@ -1,59 +1,6 @@
+require 'redis'
+require 'redis/connection/memory'
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
+ Redis = ::Redis
end
-
-require 'set'
-
-require "fakeredis/connection"
-require "fakeredis/keys"
-require "fakeredis/strings"
-require "fakeredis/hashes"
-require "fakeredis/lists"
-require "fakeredis/sets"
-#require "fakeredis/sorted_sets"
-require "fakeredis/transactions"
-require "fakeredis/server"